Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HP4x internal digi accuracy

28 views
Skip to first unread message

roy_c...@yahoo.com.hk

unread,
Mar 21, 2007, 9:52:18 PM3/21/07
to
Hi there,

Just query how accuracy of HP4x calculator, does anybody know how to
find the number of internal digi accuracy. I found some other
calculators preform less error.

For example : Forsenics Evaluation Algorithm

sin-1 cos-1 tan-1 tan cos sin 9 ==> correct answer should be 9

But HP4x gives 8.99999864247

so there must be something involve max accuracy digit. So I want to
find, any idea.

Thanks in advance.

Roy

roy_c...@yahoo.com.hk

unread,
Mar 21, 2007, 9:52:35 PM3/21/07
to

John H Meyers

unread,
Mar 22, 2007, 2:18:07 AM3/22/07
to
On Wed, 21 Mar 2007 20:52:35 -0500, Roy (in HK) wrote:

> For example: Forensics Evaluation Algorithm
[http://www.rskey.org/~mwsebastian/miscprj/forensics.htm]
> sin-1(cos-1(tan-1(tan(cos(sin(9)))))) [angle in DEGrees];
> correct [theoretical] answer should be 9
>
> But HP4x gives 8.99999864247

And my Casio fx-6300G gives 9.000015685
("is bigger better"? :)

As soon as you've performed COS(SIN(9))
you now have the value .999996272743;
this value, expressed with a fixed 12-digit mantissa,
which is the basic number storage format of "HP4x" calculators,
already only has 6-7 digits of significance remaining,
and that's what continues until the end of the computation.

To take this to a slightly greater extreme,
why doesn't COS-1(COS(1E-16)) return 1E-16?

Answer: because COS(1E-16) is too close to exactly 1.0
to be expressed by almost any calculator as its true value,
and then COS-1(1.0) results in zero, rather than the original input;
this eventually happens very near X=0 for all functions f(X)
whose value is non-zero at X=0, on all brands of calculators,
so you can always make any calculator fail such a test,
if you just carry it to beyond the number of digits of memory
which they are willing to devote to each value.

Certain special functions in the same HP calcs are designed
to eliminate that kind of error in financial calculations,
for example, by shifting the functions to pass thru [0,0]

E.g. LNP1(X), which is LN(X+1)
and EXPM(X), which is EXP(X)-1
each accept 1E-99 as input and return the same as output.

Using these two functions, you can completely accurately compute
the future value of one million evenly spaced payments of $1
at .0000001 percent interest per period,
which is prectically impossible to do
on calculators not employing these extra special functions.

> does anybody know how to find

> the number of internal digits accuracy [of HP4x calcs]

Twelve :)

That's because HP4x calcs use a fixed amount of storage
per value, in which a constant 12 significant decimal
digits are stored, with a "dynamic range" (exponent of 10)
of 10^-499 (1E-499) to almost 10^500 (9.99999999999E499)

If you want more digits to be computed,
there are contributed programs which can carry out
computations using as many digits as you like,
limited only by memory.

Some extensive calculations, however (e.g. numeric integration)
maintain 15-digit significance, with dynamic range 10^-49999 to 10^50000;
actually, almost all functions (SIN, COS, TAN, etc.)
are first evaluated internally using these "longer" values,
and then rounded to a 12-digit answer.

Interesting HP results:

1E24 - 500000000000 (HP answer: 1E24)
1E24 - 500000000001 (HP answer: 9.99999999999E23)
(this indicates that the subtraction was performed
using 25-digit values, in effect, even though
stored "user" results retain only 12 digits)

SIN(3.14159265358) [radians]
HP answer: 9.79323846264E-12

Now add (on paper) the original input (3.14159265358)
to the result (9.79323846264E-12), and you get
3.14159265358979323846264 -- this is the exactly correct
value of "pi" to 24 significant digits
(HP trig functions use a 25-digit "pi"
to make sure that even the most difficult computation,
such as the above, returns a result accurate to 12 digits).

Particular tests can be designed which look better
on one calc, while others look better on other calcs;
more about this can be found here, by Rodger Rosenbaum:
http://groups.google.com/group/comp.sys.hp48/browse_thread/thread/e5464ea257f530ee
(including the same test you mention,
performed on the "miraculous" HP30S :)

Viktor T. Toth (http://www.vttoth.com)
hosts the rskey.org calculator collection site
on which the original "forensics" test is posted;
the stated *purpose* of Mike Sebastian's test, however,
is *not* to challenge accuracy, but rather only...

"to answer the questions of who originally designed
a particular calculator's chip set, what features
of a particular calculator have been borrowed from earlier designs,
and how has calculator technology spread among the manufacturers."

And he further concludes:

"Some people may be tempted to base their evaluation
of the 'quality' of a vintage calculator
on the accuracy and precision of that calculator.
However, these are only two components
by which to evaluate a vintage calculator.
Probably the most important factor to consider
in evaluating any vintage calculator is this:
does it still work twenty-plus years after it was manufactured?
Any product that still functions as well today as it did
the day it rolled off the production line over two decades ago
is a quality vintage calculator,
and a testament to the engineers that designed it."

Well, for that sort of quality, you have to go back
to where "HP4x" meant HP41x and HP42S, etc.

Actually the HP42S (1988-1995, US$120 new)
calculates the same numeric results as HP48/49/50,
and has many of the innovations
(e.g. menus, solver, catalog, etc.)
that are exactly the same as in today's HP50G
(but it fits in your shirt pocket
and runs for years on one set of batteries :)

[r->] [OFF]

John H Meyers

unread,
Mar 22, 2007, 6:41:44 PM3/22/07
to
[the previous post concerned only real-number operations]

Forgot to mention that integer-only calculations on HP49/50 series
have unlimited precision (available memory permitting).

For example, in "Exact" mode,
2^1024 produces a 309-digit exact result.

Special operations (and algorithms) also exist in HP4x series
to improve results of numeric real (and complex) matrix
calculations, numeric integration, and other advanced functions.

Analyzing accuracy (and producing algorithms of best accuracy
within a given data and operational design framework)
is a big subject, often discussed at length in this newsgroup
by Rodger Rosenbaum (under both real name and pseudonyms).

Within various HP calculators, well-known computation expert
Prof. William Kahan http://www.cs.berkeley.edu/~wkahan/
was the architect of some of these algorithms.

It's too large a subject to cover,
and too multi-dimensional to make simple comparisons
between different calculator architectures and algorithms --
as difficult as to completely compare different people,
different locales and environments, or different cultures,
or our own existence to the existence that fills the universe.

-[ ]-

GWB

unread,
Mar 24, 2007, 8:34:12 AM3/24/07
to
On Mar 21, 10:52 pm, roy_cwc...@yahoo.com.hk wrote:
> Hi there,
>
> Just query how accuracy of HP4x calculator, does anybody know how to
> find the number of internal digi accuracy. I found some other
> calculators preform less error.
>
> For example : Forsenics Evaluation Algorithm
>
> sin-1 cos-1 tan-1 tan cos sin 9 ==> correct answer should be 9
>
> But HP4x gives 8.99999864247

Calculations are carried out with 15 digits internally, but the
results are rounded to even to twelve digits after each calculation.
That's because of HP rounding philosophy (which has been abandoned in
newer calculators like the HP-12C Platinum and the HP-30S). Were the
results not rounded, the answer would be closer to 9. This does not
mean, however, HP's algorithms are inferior, quite the contrary as we
know.

You can find more information about this, mostly by Rodger Rosenbaum,
in the following links:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=103151

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=103356

Regards,

Gerson.

Werner

unread,
Mar 24, 2007, 12:15:05 PM3/24/07
to
Hi John (second try - apologies if this gets posted twice)
A few nitpicking details, which you no doubt already knew:
- Internal calculations are not carried out 'to 25 digits'. Rather,
the use of the Sticky Bit allows to round the intermediate 15-digit
result (of a single operation!) to 12 digits as if unlimited precision
had been used in the calculation.
- According to Rodger Rosenbaum, the HP-4x (x#1) has PI stored to 31
digits. That this is so can be easily verified using the same trick
to show the 12 next digits of PI:
3.14159265358 SIN -> 9.79323846264e-12
If we perform a similar calculation in 15-digit SysRPL:
:: %%PI %%SINRAD ;
the result is 3.23846264338328E-15, corresponding to the next 15
digits of PI (the last is rounded).

Cheers, Werner

John H Meyers

unread,
Mar 24, 2007, 4:53:01 PM3/24/07
to
On Sat, 24 Mar 2007 11:15:05 -0500, Werner <werner.h...@gmail.com> wrote:

> - Internal calculations are not carried out 'to 25 digits'. Rather,
> the use of the Sticky Bit allows to round the intermediate 15-digit
> result (of a single operation!) to 12 digits as if unlimited precision
> had been used in the calculation.

Yes, it's been explained before, but
the end result being exactly "as if," then it's simply
a clever and efficient algorithm for actually accomplishing
what was claimed.

> According to Rodger Rosenbaum, the HP-4x (x#1) has PI stored to 31
> digits. That this is so can be easily verified using the same trick
> to show the 12 next digits of PI:
> 3.14159265358 SIN -> 9.79323846264e-12
> If we perform a similar calculation in 15-digit SysRPL:
> :: %%PI %%SINRAD ;
> the result is 3.23846264338328E-15, corresponding to the next
> 15 digits of PI (the last is rounded).

Pretty neat!

Cheers to you, too (678 of them, to be exact) from:
http://en.wikipedia.org/wiki/What_Cheer,_Iowa

-[ ]-

0 new messages