Rounding on PowerPC with KIND=16

Dominique Dhumieres dominiq@lps.ens.fr
Fri Feb 13 22:10:00 GMT 2015


Dear Jerry,

At least on powerpc-apple-darwin9, real(16) are implemented as a couple of real(8),
one storing the high 53 bits of the mantissa, the second one the low ones.
As a result the real(16) has only 106 "digits" compared to the 113 ones for the
real(16) handled by libquadmath. The binary mantissa of 1/10_16 is a periodic sequence
1.1001100... and the rounding will depend on the number of 'digits'.

I have seen that there is a project to use libquadmath on powerpc (with/without the IBM
real(16)), but I don't know what is the status.

> We may be emitting garbage and not realize it.

AFAIU the g0 format, it should stop at the first place needed to distinguish between the
number and its nearest neighbors, so the number of characters is probably too large for
the IBM format.

Cheers,

Dominique



More information about the Fortran mailing list