Mail Archives: djgpp-workers/1998/09/20/07:12:33
Subj: Printing very small negative FP numbers
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
To: djgpp-workers AT delorie DOT com
Dear Eli Zaretskii,
On 09-20-98 at 06:32:05 EST you wrote:
>
> The current version of *printf always removes the sign from the printed
> representation of small FP numbers that are printed as 0.000 etc. (i.e.,
> no significant digits, only zeros). This is done on purpose, since a poll
> here some time ago indicated that people don't like to see -0.0000 in the
> print-out. (Linux *does* print the minus sign, as do some, but not all,
> other platforms.)
>
> The question is: what do we print if the user asked for the sign
> explicitly, like in "%+f"? It would seem to me that in this case we
> *should* print the true sign of the number, even if the value is printed
> as all-zeros. Currently, such numbers are always printed as +0.00000
> which could be interpreted as a lie, IMHO.
>
> It doesn't seem too hard to fix this, if people think this should be
> fixed.
>
> Comments?
My personal preference is for the correct sign to be printed on inexact
printouts of very small FP numbers. When a minus sign appears, an alert
is triggered in the mighty brain. For one thing, it tells me that perhaps
the printout should be changed from 'f' format to either 'g' or 'e' format.
My vote is squarely on the side of printing the minus sign.
K.B. Williams
- Raw text -