HP-17BII Precision: Epsilon « Next Oldest | Next Newest »

## Calculating Epsilon on the HP-17BII

I wrote a program to compute 'Epsilon' which---in computational context---means the
smallest number (in the computer) that may be added to one and yield a result
that is greater than one. It is a measure of the precision that the
computer uses to represent numbers (really the number of bits used for the
mantissa).

I first wrote a traditional "Epsilon" equation for the HP-17BII, but I
realized that the number storage was not the standard binary floating point,
but rather some form of binary-coded-decimal. As a result, the original
"Epsilon" program yielded an incorrect result. The general algorithm
may be used on any machine that stores floating point numbers in an IEEE-like
format. So, I re-wrote the equation for a binary-coded-decimal machine.
The new equation yields the correct result for the HP-17BII; the Epsilon
is 5.00000000001e-12 (twelve digits in the mantissa).

Binary Floating-Point Epsilon algorithm---INCORRECT for HP-17BII:

```Epsilon = 1;
while ((1 + Epsilon) > 1) {
Epsilon /= 2;
}
Epsilon *= 2;
```

Below is the HP-17BII equation. Please note that in the listing below
"SIGMA" means the sigma symbol:

In the ALPHA menu:

[WXYZ][OTHER][MORE],

then the second button

Binary-Coded-Decimal equation for the HP-17BII:

```EPSILON: 0*L(E:1)*
SIGMA(N:1:25:1:(
SIGMA(I:1:9:1:
IF(1+L(X:(G(E)-I*10^(-N)))>1:
L(NEWE:G(X))
:
0
)
)
+L(OLDE:G(E))
+L(E:G(NEWE))
)
)
+
IF(G(OLDE)>G(E):
0
:
G(E)
)
=EPSILON
```

The extra code concerning the "OLDE" variable is just to make sure
that we have looped far enough. If Epsilon comes back as zero, then we
need to search more powers of ten in the "N" loop (i.e. increasing
the value of 25 here).

 Possibly Related Threads... Thread Author Replies Views Last Post Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 3,495 11-28-2013, 02:36 AM Last Post: Don Shepherd 17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 2,201 11-25-2013, 10:28 AM Last Post: Don Shepherd HP Prime numerical precision in CAS and HOME Javier Goizueta 5 1,709 11-16-2013, 03:51 AM Last Post: Paul Dale Is the Prime a superset of the HP 17bII+ ? vrrr 3 1,296 10-16-2013, 12:03 PM Last Post: Michael de Estrada hp 17bii+ dates calculation... JoePaul 6 1,893 07-14-2013, 11:32 AM Last Post: Katie Wasserman HP-17bII+ emulator problem (TW?) fhub 7 1,853 06-23-2013, 09:57 AM Last Post: Olivier De Smet [wp34s] Converting to/from IEEE 754 Binary64 (Double Precision) David Maier 1 885 06-15-2013, 09:21 PM Last Post: Paul Dale Precision DC-50 Mic 3 1,250 05-26-2013, 01:27 PM Last Post: DavidM HP-17bII+ Solve Compatibility Issues Robert Prosperi 7 2,238 04-22-2013, 10:11 PM Last Post: Gerson W. Barbosa A very long HP-17BII equation Gerson W. Barbosa 22 4,127 04-19-2013, 12:37 AM Last Post: Gerson W. Barbosa

Forum Jump: