Decimal Floating-Point: Algorism for Computers



Similar documents
ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

HOMEWORK # 2 SOLUTIO

Number Representation

CS321. Introduction to Numerical Methods

Practical Programming, 2nd Edition

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Binary Numbering Systems

CSI 333 Lecture 1 Number Systems

The string of digits in the binary number system represents the quantity

Systems I: Computer Organization and Architecture

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti

CHAPTER 5 Round-off errors

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Attention: This material is copyright Chris Hecker. All rights reserved.

NUMBER SYSTEMS. William Stallings

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Floating Point Fused Add-Subtract and Fused Dot-Product Units

Numbering Systems. InThisAppendix...

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

8 Square matrices continued: Determinants

Section 4.1 Rules of Exponents

Base Conversion written by Cathy Saxton

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Lecture 11: Number Systems

RN-coding of Numbers: New Insights and Some Applications

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

What Every Computer Scientist Should Know About Floating-Point Arithmetic

Some Functions Computable with a Fused-mac

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

FLOATING-POINT ARITHMETIC IN AMD PROCESSORS MICHAEL SCHULTE AMD RESEARCH JUNE 2015

Solution for Homework 2

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

THE EXACT DOT PRODUCT AS BASIC TOOL FOR LONG INTERVAL ARITHMETIC

Teaching Pre-Algebra in PowerPoint

Addition Methods. Methods Jottings Expanded Compact Examples = 15

Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD

on an system with an infinite number of processors. Calculate the speedup of

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

The gas can has a capacity of 4.17 gallons and weighs 3.4 pounds.

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

COMPSCI 210. Binary Fractions. Agenda & Reading

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Pemrograman Dasar. Basic Elements Of Java

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

Fast Logarithms on a Floating-Point Device

Numerical Analysis I

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Useful Number Systems

A Short Guide to Significant Figures

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Section 1.4 Place Value Systems of Numeration in Other Bases

İSTANBUL AYDIN UNIVERSITY

A New, High-Performance, Low-Power, Floating-Point Embedded Processor for Scientific Computing and DSP Applications

Instruction Set Architecture (ISA)

Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs

RN-Codings: New Insights and Some Applications

Negative Exponents and Scientific Notation

Lecture 2. Binary and Hexadecimal Numbers

Negative Integer Exponents

Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK

Q-Format number representation. Lecture 5 Fixed Point vs Floating Point. How to store Q30 number to 16-bit memory? Q-format notation.

Pre-Algebra Lecture 6

REVIEW SHEETS BASIC MATHEMATICS MATH 010

ERserver. DB2 Universal Database for iseries SQL Programming with Host Languages. iseries. Version 5

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

MATH-0910 Review Concepts (Haugen)

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

Introduction to Xilinx System Generator Part II. Evan Everett and Michael Wu ELEC Spring 2013

Fast Arithmetic Coding (FastAC) Implementations

Overview. java.math.biginteger, java.math.bigdecimal. Definition: objects are everything but primitives The eight primitive data type in Java

Figure 1. A typical Laboratory Thermometer graduated in C.

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

A new binary floating-point division algorithm and its software implementation on the ST231 processor

Let s put together a Manual Processor

SOLVING EQUATIONS WITH RADICALS AND EXPONENTS 9.5. section ( )( ). The Odd-Root Property

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

THE BINARY NUMBER SYSTEM

Expert Reference Series of White Papers. Simple Tricks To Ace the Subnetting Portion of Any Certification Exam COURSES.

5.1 Radical Notation and Rational Exponents

Supported Platforms and Software Requirements Effective on 7 May HULFT-DataMagic for Windows Ver.2.2.0

MULTIPLICATION AND DIVISION OF REAL NUMBERS In this section we will complete the study of the four basic operations with real numbers.


Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

(Refer Slide Time: 00:01:16 min)

Radicals - Multiply and Divide Radicals

Binary Adders: Half Adders and Full Adders

A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL

Instruction Set Design

Paramedic Program Pre-Admission Mathematics Test Study Guide

Transcription:

Decimal Floating-Point: Algorism for Computers Arith16 16 June 2003 Mike Cowlishaw IBM Fellow http://www2.hursley.ibm.com/decimal decarith16

Overview Why decimal arithmetic is increasingly important Why hardware support is needed How decimal arithmetic is done Copyright IBM Corporation 2003. All rights reserved.

Origins of decimal arithmetic Decimal (base 10) arithmetic has been used for thousands of years Algorism (Indo-Arabic place value system) in use since 800 AD Many early computers were decimal

Decimal computation today Pervasive in financial, commercial, and human-centric applications often a legal requirement Benchmarks do not reflect actual use 55% of numeric data in databases are decimal (and a further 43% integers)

Why floating-point? Traditional integer arithmetic with manual scaling is awkward and error-prone Floating-point is increasingly necessary division and exponentiation interest calculated daily telephone calls priced by the second calculators, financial analysis, etc.

Why not use binary FP? binary fractions cannot exactly represent all decimal fractions 1.2 x 1.2 1.44? 1.2 in a 32-bit binary float is actually: 1.2000000476837158203125 and this squared is: 1.440000057220458984375

A financial example 5% sales tax on a $ 0.70 telephone call, rounded to the nearest cent 1.05 x 0.70 using binary double type is 0.73499999999999998667732370449812151491641998291015625 (should have been 0.735) rounds to $ 0.73, instead of $ 0.74

Hence Binary floating-point cannot be used for commercial applications cannot match values computed by hand cannot meet legal and financial requirements, which are based on 2,500+ years of decimal arithmetic So applications use decimal software floating-point packages

...but decimal software is slow some measurements times in µs x=y+z x=y*z x=y/z Java BigDecimal 1.250 1.100 8.440 Binary hardware 0.006 0.006 0.078 Decimal penalty 208x 183x 108x (These are 9-digit timings. 27-digit calculations are 9x worse for multiply and divide.)

Effect on real applications The telco billing application 1,000,000 calls read from file, priced, taxed, and printed (two minutes-worth) time in decimal operations fastest C package 72.2% Java BigDecimal 93.2%

The path to hardware A 2x to 10x performance improvement in applications makes hardware support very attractive IEEE 854 tells us how to compute the value of floating-point results We can use redundant encodings to allow fixed-point and integer arithmetic, too

Traditional two-integer form Allows integer, fixed-point, and floatingpoint numbers in one representation integers always have exponent = 0 in general: numbers with the same number of decimal places have the same exponent, and need no alignment for addition e.g., 1.23 and 123.45 both have exponent -2 [123, -2] and [12345, -2]

Example: multiplication The significands are multiplied (an integer operation), and the exponent is the sum of the operand exponents 123E-2 x 45E-1 gives 5535E-3 122E-2 x 45E-1 gives 5490E-3 Independent calculations for the two parts No further processing is necessary unless rounding (etc.) is needed

Rounding Correct rounding, as in IEEE 754/854 additional rounding mode (round-half-up) A rounded normal number will always have maximum digits (the first digit will be non-zero) Subnormals may have leading zero digit(s)

Note The core operations when no rounding occurs are simple integer operations; integer arithmetic is a subset Comparison does not distinguish between redundant encodings of the same value The rules are base-independent

Integer-based floating-point Compatible with: IEEE 754/854 manual processes (algorism) legal requirements programming language data types (COBOL, PL/I, Java, C#, Rexx, Visual Basic, etc.) databases (DB2, SQL Server, Oracle, etc.) application testcase data formats mixed-type arithmetic: 12 x $ 9.99

Summary Hardware two-integer arithmetic (or the equivalent) gives same results as software allows the hardware to be used to accelerate existing applications and processes e.g., a typical large bank has 1,480 programmers, 65 application subsystems, 900+ IT projects/year, and 10,000+ programs in use This does not conflict with IEEE 754/854 allows integer and FP in the same unit

Questions? http://www2.hursley.ibm.com/decimal (Google: decimal arithmetic)