Mail Archives: djgpp-workers/2003/08/11/00:57:41
> Date: Sun, 10 Aug 2003 19:12:06 -0400
> From: DJ Delorie <dj AT delorie DOT com>
>
> > Is it? We are printing a long double, which IIRC has 19 significant
> > digits. The ``error'' here happens in the 20th digit, unless I'm
> > mistaken.
>
> Long doubles have 64 bits of mantissa, with a separate sign. We
> should have no problems representing, and thus printing, 2**64-2.
In a long double, the mantissa includes the integer bit, unlike in a
float or a double. Se we lose one bit.
> The fact that Linux can get it right means that the format can
> represent the numbers just fine.
AFAIU, the format is not the issue here. We are discussing the string
of digit characters that is produced by printing the numbers. (I'd be
interested in seeing the actual bit patterns of the numbers as shown
by a debugger; I'm quite sure these bit patterns are okay.) Since
_doprnt does some amount of math on its argument, loss of precision
beyond the significant digits is inevitable. One should expect
singular failures like that.
(Btw, I have a vague recollection we already had this discussion in
the past, with this same example.)
- Raw text -