Round off error calculation example
|
07-23-2017, 05:07 PM
(This post was last modified: 07-23-2017 05:13 PM by Dieter.)
Post: #5
|
|||
|
|||
RE: Round off error calculation example
(07-23-2017 10:16 AM)Gamo Wrote: I came across this example from youtube about the round off error on the older computer start from the earlier Pentium CPU which is about the floating point units. Here is the sample: ((2^54)+1)-(2^54) = 0 or 1 ? Sure. This is the expected result. 2^54 = 18 014 398 509 481 984. This is a number with 17 digits. The standard IEEE754 floating point format has 15-16 decimal digits. It works with 52 resp. 53 bit precision, that's why the example uses 2^54. Most calculators even work with merely 10 or 12 digits. So in any case 2^54 cannot be represented exactly, and of course adding or subtracting 1 does not make any difference as only the 17th digit is affected. Example: on an 12-digit machine you get 2^54 = 1,80143985095 · 10^16. Add one and the result still is 1,80143985095 · 10^16. Finally subtract 1,80143985095 · 10^16 and – of course – you get zero. BTW the Windows calculator works with 30+ digits, so it returns 1 here. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Round off error calculation example - Gamo - 07-23-2017, 10:16 AM
RE: Round off error calculation example - Arno K - 07-23-2017, 10:29 AM
RE: Round off error calculation example - Joe Horn - 07-23-2017, 11:57 AM
RE: Round off error calculation example - Csaba Tizedes - 07-23-2017, 12:24 PM
RE: Round off error calculation example - Dieter - 07-23-2017 05:07 PM
RE: Round off error calculation example - Mark Hardman - 07-23-2017, 06:32 PM
RE: Round off error calculation example - Dieter - 07-23-2017, 07:03 PM
RE: Round off error calculation example - Gamo - 07-24-2017, 01:17 AM
|
User(s) browsing this thread: 2 Guest(s)