![]() |
wp34s (Why it's so accurate) - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: wp34s (Why it's so accurate) (/thread-247738.html) |
wp34s (Why it's so accurate) - Barry Mead - 08-03-2013 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 wp34s keeps it's full 16-digit decimal numbers in a decimal format for each and every digit THROUGHOUT EVERY STEP of
At least there are no errors that result from converting numbers
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
When you put your wp34s into Double Precision mode with [h][mode]DBLON it uses the Decimal 128 format where it fits Thanks for making the wp34s so accurate!
Edited: 4 Aug 2013, 1:52 a.m.
Re: wp34s (Why it's so accurate) - Monte Dalrymple - 08-04-2013 Actually, most calculators use BCD, just not with 64 bits.
Re: wp34s (Why it's so accurate) - Walter B - 08-04-2013 Quote:That goes to Pauli :-) Quote:You could have reached that level easier - see below ;-) Quote:... pp. 179f of the printed manual :-) Quote:Please see p. 211 of the printed manual :-) Quote:Me too. It's called "reading" ;-)
d:-)
Re: wp34s (Why it's so accurate) - Marcus von Cube, Germany - 08-04-2013 We're using the decNumber library of which the decimal64 and decimal128 formats are part of. Computations aren't executed directly on the decimalXXX objects, they are transformed into decNumber objects. The latter are much more memory consuming but have important advantages: easier access to the digits, signs and flags, and arbitrary precision. The decimalXXX format is used for storage of numbers in registers because it's more compact. We are loosing some digits in the process because internal computations are done with even higher accuracy (typically 39 digits, sometimes more) and the results are converted back to 16 or 34 digits, depending on the register size.
To be precise, we skipped a memory consuming step in the conversion and are using a slightly simplified method to encode three digits into 10 bits. We are actually using a base 1000 format with a base 10 exponent. It's still named decimal64 or decimal128 internally but you cannot directly exchange the data with other applications using the original encoding. Edited: 4 Aug 2013, 3:51 a.m.
Re: wp34s (Why it's so accurate) - Paul Dale - 08-04-2013 And those that do use 64 bit BCD arithmetic (the twelve digit HPs e.g.) don't use a tightly packed format like the 34S. This is a trade off. Alpha strings cannot be distinguished from numbers using packed decimals like they can on the 41 series. Likewise, matrix descriptors cannot be distinguished from numbers like they are on the 15c.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 Yes but most calculators don't incorporate the advanced rounding rules that are incorporated into the wp34s! Rounding can make a
I never see these rounding inaccuracies on the wp34s.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 I read the manual, and didn't find the description there as comprehensible as the Wikipedia article referenced above.
It made sense to me after stumbling upon the Wikipedia article, but still seemed confusing when I tried to interpret this theory directly from the manual. I am not saying that the manual isn't well written, only that occasionally looking at something from another perspective Thanks again for creating this open-source collaboration!
This calculator is a good example of what mankind can do when
I think we have all sensed that Hewlett Packard isn't the company
I miss that kind of workmanship, and it's obvious that the creators
Edited: 4 Aug 2013, 9:57 a.m.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 Base 1000 cool! That seems MUCH simpler than the IEEE 754 method of encoding 3-digits into 10-bits. Very cleaver. When too many people try to decide things that are to be a standard in a big committee it always seems to be more bureaucratic and less innovative. Thanks Marcus for the description of how it's actually done in the wp34s.
This calculator reminds me of an onion. The more layers I unwrap (comprehend) the more layers of cool technology I find beneath them. Edited: 4 Aug 2013, 9:53 a.m.
Re: wp34s (Why it's so accurate) - Dieter - 08-04-2013 Quote:Could you provide an example for this? I do not think the 15C (or any other HP) is inaccurate or does not round correctly. In most cases it's simply the fact that even in single precision mode the 34s uses 16 digits while only the first 12 are displayed. ;-)
Dieter
Re: wp34s (Why it's so accurate) - Mike Morrow - 08-04-2013 Quote: Yes. Workmanship like the 'excellent' Woodstock battery charging calculator self-destruct system, the early Spice PCB problems and Spice battery compartment flimsiness, HP-67 potential damage if used with AC charger but no battery, Clamshell battery compartment defects, etc. All of them retailed at very high prices.
I used an HP for the first time in 1972, when the HP-35 showed up at the Georgia Tech Bookstore. Having experience with HP from the beginning, I don't buy the mythology of HP perfection in "the good ol' days". I very much like my 1988 HP42S and 2006 HP 50G, and I'm looking forward to the 2013 HP Prime.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 Example of rounding errors in HP-15C!
Using the HP-15C, put the 2x2 matrix 1234 into matrix A and take the inverse of You get 1.000000001,2.000000001, 3.000000002, 4.000000002
On the wp34s you get exact values with no rounding errors doing
Edited: 4 Aug 2013, 1:38 p.m.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 I have an original HP-35 and when HP discovered that they had made a mistake in the firmware (2.02 ln e^x showed 2.0), they offered to repair it for free! This kind of customer care does not exist anymore! This is what I was referring to when I said that HP isn't the company that it used to be.
Edited: 4 Aug 2013, 1:44 p.m.
Re: wp34s (Why it's so accurate) - Marcel Samek - 08-04-2013 The HP-35 launched at $395 in 1972 which works out to be over $2000 in today's dollars. The cost of a product does factor into the decisions any company makes about the level of support they offer. It isn't really valid to compare HP's support for the original HP-35 to its support for today's sub-$200 devices.
Re: wp34s (Why it's so accurate) - Dieter - 08-04-2013 Well, that's easy to explain. On the 34s, most internal calculations are done with 39-digit precision, sometimes even more, and even the XROM-coded functions use 34-digit precision. Since the matrix routines always return single-precision results, there are 39 minus 16 = 23 (!) additional guard digits. Plenty of room to cover roundoff errors. ;-) Compare this to just 3 (three) additional digits on most HP machines (e.g. HP-15C = 10 digit display => 13 digits internal precision). So 9 correct digits out of 13 used internally does not look too bad to me. If the results of the 34s matrix functions could be examined in all of their 39 internal digits, you should not be surprised to see some roundoff errors in the 35th digit either. ;-)
Dieter
Re: wp34s (Why it's so accurate) - Walter B - 08-04-2013 Quote:There is some reason why WP 34S matrix commands don't work in DP ;-) Anyway, I think most people can well live with matrix results being accurate to 16 digits.
d:-)
Re: wp34s (Why it's so accurate) - Paul Dale - 08-04-2013 The matrix routines are more complicated. True, the full internal 39 digit precision is used for basic computations, however many intermediates are stored and accumulated in 34 digit precision to conserve the very limited RAM.
Re: wp34s (Why it's so accurate) - Paul Dale - 08-04-2013 Encoding 3 digits in ten bits is base one thousand still. This is one case where the standard is extremely well thought out. Read about the history of the IEEE 754 standard. Although, politics was involved, the technically best solution made it in the end. Interview with Kahan and lots of documents from his web page. The IEEE 854 standard continued making the right decisions and was subsequently reintegrated back into the 754 standard as the base ten implementation. - Pauli
Edited: 5 Aug 2013, 6:13 p.m. after one or more responses were posted
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 While it is true that the calculator was expensive for that time period, I don't believe HP has been as magnanimous, even with it's expensive products lately. I like the HP-30B, it makes a good platform on which to build the wp34s, but I remember back to he 60's and 70's where the name HP was synonymous with "HIGH QUALITY TEST EQUIPMENT". Today, I can find better quality products at cheaper prices than what is provided by HP in most cases.
I stand by my assertion that Hewlett Packard isn't the Pillar of Integrity and Quality that it once was.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 I still contend that the wp34s IS MORE ACCURATE than the HP-15C!
Weather the wp34s is more accurate because it shows 12 of 16 digits
I also believe that the sophisticated user configurable rounding rules shown on page 110 of the printed manual further support the
It don't see why this issue should be disputed. Edited: 4 Aug 2013, 9:38 p.m.
Re: wp34s (Why it's so accurate) - Barry Mead - 08-04-2013 I think what Marcus said about using base 1000 encoding I concur that the remainder of the IEEE754 spec is very cleaver and yields maximum number ranges in a minimum of bits.
But I can also see why Marcus deviated from the spec in this one area as it vastly simplifies the declet encoding and decoding process.
Re: wp34s (Why it's so accurate) - Paul Dale - 08-04-2013 The densely packed decimal encoding is also very clever and provides a number of benefits when used. In the 34S, we didn't need any of these and we saved a kilobyte or two of flash. It really isn't complex, it involved a single table look up per ten bits when converting either way. For us, by far the largest benefit was the space saving. It would have been nice to be able to say we support the IEEE standard at the bit level, but we don't. Our arithmetic is equivalent otherwise but we really needed the space.
Re: wp34s (Why it's so accurate) - Andrés C. Rodríguez (Argentina) - 08-05-2013 Hi, Please see that the links in your post are not working. If possible, please suggest alternative ways to access such interesting materials. Thank in advance, and - of course - for your work in the wonderful HP34S.
Best regards,
Re: wp34s (Why it's so accurate) - fhub - 08-05-2013 Quote:Just one http too much. ;-) Interview with Kahan and lots of documents from his web page.
Franz
|