Floating point How arithmetic operations mathematics involving - - PowerPoint PPT Presentation

floating point
SMART_READER_LITE
LIVE PREVIEW

Floating point How arithmetic operations mathematics involving - - PowerPoint PPT Presentation

Numerical and Scientific Computing with Applications David F . Gleich CS 314, Purdue September 7, 2016 In this class: Floating point How arithmetic operations mathematics involving floating point numbers work. Next class IEEE


slide-1
SLIDE 1

QUIZ and floating point math Floating Point

G&C – Chapter 5 Numerical and Scientific Computing with Applications David F . Gleich CS 314, Purdue September 7, 2016

Floating point mathematics

Next class

Monte Carlo algorithms

G&C – Chapter 3 Next next class In this class:

  • How arithmetic operations

involving floating point numbers work.

  • IEEE rounding modes and

the guarantees of an IEEE system.

  • (An example of why even

simple computations oven discard many significant digits.

slide-2
SLIDE 2

The most important person you’ve never heard of (yet)!

slide-3
SLIDE 3

William Kahan

Fought to get a standard to floating point arithmetic that provided useful mathematical properties. Won a Turing award (the “Nobel prize” of CS) for this!

slide-4
SLIDE 4

Quick review

A floating point number

slide-5
SLIDE 5

Quick review

A floating point number

  • a sign
  • an exponent
  • a mantissa
slide-6
SLIDE 6

Toy system

1 bit for sign 2 bits of mantissa 2 bits for exponent (-1,0,1,∅) 1 10 0 = (-1)1 × (1.10)2 × 20

slide-7
SLIDE 7

Real system

Inf and NaN values too! IEEE Single

  • 1 bit for sign
  • 8 bits for exponent
  • 23 bits for mantissa
  • Bias=127, ∅ = 0, Inf=255

IEEE Double

  • 1 bit for sign
  • 11 bits for exponent
  • 52 bits for mantissa
  • Bias=1023, ∅=0, Inf=2048

IEEE Quad

  • 1 bit for sign
  • 15 bits for exponent
  • 112 bits for mantissa
  • Bias = , ∅ = 0

(-1)sign × (1.mantissa)2 × 2exponent-bias

slide-8
SLIDE 8

An important property of floats

  • Subnormal numbers
  • Machine epsilon (the difference between 1

and the next largest floating point number)

0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 1 5/4 6/4 7/4

slide-9
SLIDE 9

An important property of floats

  • Subnormal numbers
  • Machine epsilon (the difference between 1

and the next largest floating point number)

0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 1 5/4 6/4 7/4 1/4

slide-10
SLIDE 10

… demo ...

slide-11
SLIDE 11

… back to board ...