HITECH C 3.09 Z80

The original HITECH C linker (LINK.COM) has been renamed as LINQ.COM and the C.COM compiler has been modified to invoke this linker. This was done to avoid a name conflict with the CP / M linker provided by Digital Research. As provided in v3.09, the LIBF. LIB produces inaccurate floating-point trigonometry results, as reported by “Ed” in his post to the USENET newsgroup comp.os.cpm.

The Hi-tech compiler uses a 32-bit representation of float numbers. The first bit is the sign of the number the following 7 bits represent the exponent with an offset of 64, the remaining 24 bits represent the mantissa in normalized form.

The Hi-tech C compiler uses the same amount of bits for both float and double so the machine epsilon is the same in both cases. If you do a search you will find that according to IEEE 754 – 2008 in the case of 32-bit binary representation (single precision) the machine epsilon is equal to approximately 1.19e-07.

But since we are curious let’s see how it is calculated.


#include <float.h>
#include <math.h>

void main(void)
{
      float eps;
      int cifre = 0;
      eps = 1;

      while ((1+eps)&amp;amp;amp;amp;amp;gt;1)
      {
           eps = eps*0.5;
           cifre++;
      }
      eps = eps*2;

      printf ("Calcolo epsilon macchina\n");
      printf ("Cifre mantissa: %d\n",cifre);
      printf ("Epsilon: %.16e",eps);
}

We call for the compilation

C>c -v epsilon.c -lf

C>epsilon

The result will be:

Epsilon computation machine
Mantissa
digits : 24 Epsilon: 1.1920927000000000e-07

There is evidently a difference between the smallest representable number and the machine epsilon. The machine epsilon represents the achievable precision that is the distance (which is not constant) in the representation of the float values, explained very roughly. What is the use of knowing the machine epsilon? It is essential to keep error propagation under control while running algorithms.

 

Loading