Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: How to avoid wrong answers in simple arithmetic expressions.
Replies: 13   Last Post: Jan 20, 2013 7:18 AM

 Messages: [ Previous | Next ]
 Bruno Luong Posts: 9,303 Registered: 7/26/08
Re: How to avoid wrong answers in simple arithmetic expressions.
Posted: Jan 20, 2013 6:58 AM

"SK " <modysk@hotmail.com> wrote in message <kdgkg1\$a14\$1@newscl01ah.mathworks.com>...
>
> All right, suppose I say all integers between -2^52 and 2^52 can be represented exactly - I did say "within some range" without specifying what that range was.

That's better.

All integers are sum of powers of 2 (or powers of x, x is whatever you like), so there is no point in involving the basis when discussing integer in floating-poimt coding. The range 2^52 come from the fact that 52 bit is used by the mantissa of double precision IEEE.

Very often miss-believing occur when user manipulate fractional number such as 0.1. The number 0.1 = 1/10 = 1/(2*5) cannot be represented exactly in binary basis, and human notation for 0.1 happens to be finite because we count in 10 basis. On the other hand 0.1 cannot be codded finitely in binary basis (computer), just like 1/3 cannot be written with finite decimal digit numbers. Therefore non-accuracy occurs in arithmetic operations for decimal fractional numbers.

Bruno

Date Subject Author
1/19/13 S.K.Mody
1/19/13 dpb
1/19/13 dpb
1/19/13 S.K.Mody
1/19/13 James Tursa
1/20/13 S.K.Mody
1/20/13 S.K.Mody
1/20/13 Bruno Luong
1/20/13 S.K.Mody
1/20/13 Bruno Luong
1/20/13 S.K.Mody
1/20/13 Bruno Luong
1/20/13 S.K.Mody