representing fractions fixed point l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Representing fractions – Fixed point PowerPoint Presentation
Download Presentation
Representing fractions – Fixed point

Loading in 2 Seconds...

play fullscreen
1 / 35

Representing fractions – Fixed point - PowerPoint PPT Presentation


  • 185 Views
  • Uploaded on

Representing fractions – Fixed point. The problem: How to represent fractions with finite number of bits ? . Representing fractions – Fixed point. A number with 10 bits. a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10. Representing fractions – Fixed point. A number with 10 bits.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Representing fractions – Fixed point' - lunette


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
representing fractions fixed point
Representing fractions – Fixed point
  • The problem:
    • How to represent fractions with finite number of bits ?
representing fractions fixed point2
Representing fractions – Fixed point

A number with 10 bits

a1a2a3a4a5a6a7a8a9a10

representing fractions fixed point3
Representing fractions – Fixed point

A number with 10 bits

a1a2a3a4a5a6a7a8a9a10

a1a2a3a4a5a6a7a8.a9a10

Fixing the point

fixed point the problem
Fixed point : the problem
  • Cannot represent wide ranges of numbers.
    • In scientific applications.
representing fractions floating point
Representing Fractions – Floating point

1 * 101

10

Base (radix) - r

-1.23 * 10-2

-0.123

representing fractions floating point7
Representing Fractions – Floating point

1 * 101

10

exponent

-1.23 * 10-1

-0.123

representing fractions floating point8
Representing Fractions – Floating point

1 * 101

10

Number (Mantissa)

-1.23 * 10-1

-0.123

representing fractions floating point9
Representing Fractions – Floating point

(-1)0*1 * 101

10

Sign bit

(-1)1*1.23 * 10-1

-0.123

problem of uniqueness
Problem of uniqueness

100*10-4

0.1

Representation is not Unique

0.001*102

problem of uniqueness normalization
Problem of uniqueness - Normalization

610*10-4

0.61

6.1*10-1

Standardization

One digit to the

Left of the point

0.0061*102

normalized binary floating point
Normalized Binary Floating point

D = (-1)a0 * (1.a1a2a3…)*2b1b2b3…

a0b1b2…bna1a2a3…am

String of bits

floating point questions
Floating point - Questions
  • Representing the (signed) exponent
  • How to represent zero?
    • And Nan, infinity ?
  • How to add, subtract and multiply?
  • Rounding Errors.
floating point representing the exponent
Floating point – Representing the exponent

How to represent singed number ?

Sign bit

2-Complement

floating point representing the exponent15
Floating point – Representing the exponent

How to represent singed number ?

Sign bit

Neither

2-Complement

floating point representing the exponent16
Floating point – Representing the exponent
  • We want the exponent to be binary ordered:

0000 < 0001 < …. < 1000 < … < 1111

floating point representing the exponent17
Floating point – Representing the exponent

Number = Number - B

Usually B = 2n-1-1

We define the following sizes like this:

emin

000…0001

emax

111…1110

floating point representing zero nan
Floating point – Representing zero,NAN, ±

IEEE754 special values

Denormalized

number

normalized

number

ieee 754
IEEE 754

(Including the sign

Bit)

infinity
Infinity
  • Provide a safe was to continue calculation when overflow is encountered.
calculations with floating point numbers
Calculations with Floating Point numbers
  • Addition:
    • Equalize the exponents (smallerlarger exponent)
    • Sum the mantissa
    • Renormalize if necessary
calculations with floating point numbers23
Calculations with Floating Point numbers
  • Example (in base 10):

|E| = 1 , |M| = 3

91  9.10*101

9.7  9.70*100

calculations with floating point numbers24
Calculations with Floating Point numbers

9.10*101

+ 9.70*100

Not The same Order.

calculations with floating point numbers25
Calculations with Floating Point numbers

9.10*101

+ 0.97*101

9.10*101

+ 9.70*100

10.7*101

renormalize

1.07*102

calculations with floating point numbers26
Calculations with Floating Point numbers
  • Example II (in base 10):

|E| = 1 , |M| = 3

91  9.10*101

9.75  9.75*100

calculations with floating point numbers27
Calculations with Floating Point numbers

9.10*101

+ 9.75*100

Not The same Order.

calculations with floating point numbers28
Calculations with Floating Point numbers

9.10 *101

+ 0.975*101

9.10*101

+ 9.75*100

10.75*101

renormalize

5

(rounding error)

1.07*102

rounding errors
Rounding Errors

The Problem:

Squeezing infinite many real numbers into a finite number of bits

measuring rounding errors
Measuring Rounding Errors
  • Units in last place (Ulps)
  • Relative Error
measuring rounding errors ulp
Measuring Rounding Errors – ULP

p digits

If d.dddd*re represent z

error = |d.dddd – (z/re)|*rp-1

measuring rounding errors ulp32
Measuring Rounding Errors – ULP

Example I: r = 10 , p = 3

The number 3.14*10-2 represents 0.0314159

Error = 0.159

measuring rounding errors ulp33
Measuring Rounding Errors – ULP
  • What is the maximum ULP if the rounding is toward the nearest number?

0.5 ULP

measuring rounding errors relative error
Measuring Rounding Errors – Relative Error

p digits

If d.dddd*re represent z

Relative error = |d.dddd*re – z|/z

measuring rounding errors relative errors
Measuring Rounding Errors – Relative errors

Example I: r = 10 , p = 3

The number 3.14*10-2 represents 0.0314159

Relative Error ~ 0.0005