wp34s (Why it's so accurate) Message #1 Posted by Barry Mead on 3 Aug 2013, 11:46 p.m.
I looked into the source code for the wp34s and discovered something that I had not been familiar with before. The IEEE came up with a cool way to store 16 decimal digits with an exponent of 10^+384 to 10^-383 into only 64bits. This format is defined by the IEEE 754 specification and with it the wp34s does all of its decimal calculations on base 10 decimal digits directly!
The reason many floating point libraries and older calculators get all of these inaccuracies is because they compute things in the floating point binary number system, then convert the answer back into decimal digits at the end where rounding errors creep in.
When you try to represent a decimal number in a binary number system
the least significant 2 or 3 digits can get errors in them.
This is because the binary representation does not accurately translate into decimal numbers for every digit.
The wp34s keeps it's full 16-digit decimal numbers in a decimal format for each and every digit THROUGHOUT EVERY STEP of
every calculation, so there are almost never any rounding errors.
At least there are no errors that result from converting numbers
to and from decimal and binary.
If you are curious as to how the wp34s fits 16 decimal digits and an exponent of 10^+384 to 10^-383 all into a 64 bit space look at this
nice page on
Wikipedia Decimal64
When you put your wp34s into Double Precision mode with [h][mode]DBLON it uses the Decimal 128 format where it fits
34 decimal digits plus an exponent of 10^+6144 to 10^-6143 all
into 128 bits. Wikipedia Decimal128 I find this technology fascinating.
Thanks for making the wp34s so accurate!
Edited: 4 Aug 2013, 1:52 a.m.
|