[Cfp-interest 1733] Re: short hex strings

David Hough CFP pcfp at oakapple.net
Thu Jul 30 06:26:22 PDT 2020


This looks good to me.

> 295)Binary implementations can choose the hexadecimal digit to the left =
> of the decimal-point character so that subsequent digits align to nibble =
> (4-bit) boundaries. This implementation choice affects numerical values =
> printed with a precision P that is insufficient to represent all values =
> exactly. Implementations with different conventions about the most =
> significant hexadecimal digit will round at different places, affecting =
> the numerical value of the hexadecimal result. For example, possible =
> printed output for the code=20
> 
> #include <stdio.h>
> =E2=80=A6
> double x =3D 123.0;
> printf("%.1a", x);=20
> 
> include "0x1.fp+6" and "0xf.6p+3=E2=80=9D whose numerical values are 124 =
> and 123, respectively. Portable code seeking identical numerical results =
> on different platforms should avoid precisions P that require rounding.


More information about the Cfp-interest mailing list