bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf "%010a" Inf/NaN and FreeBSD


From: Eric Blake
Subject: Re: printf "%010a" Inf/NaN and FreeBSD
Date: Wed, 04 Apr 2007 20:39:44 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 4/4/2007 6:28 PM:
> On FreeBSD 6.1, printf of "%010a" of Infinity and NaN yields
> "0000000inf" and "0000000nan", respectively.
> 
> While on glibc systems, it yields
> "       inf" and "       nan", respectively.
> 
> I find glibc's output more sensible, since strtod will accept it, while
> strtod will not grok "0000000inf". But FreeBSD appears to be closer to
> the POSIX wording, I won't count it as a FreeBSD bug.

I would, though.  POSIX allows "inf" vs. "infinity", but unless %010f
prints "0000000inf", I don't think %010a should do so either, because
POSIX was clear that "A double argument representing an infinity or NaN
shall be converted in the style of an f or F conversion specifier."

For that matter, I would really like it if you could guarantee that the
digit immediately before the . were less than FLT_RADIX.  POSIX doesn't
require it, but I find it nicer to see 0x1.0p+0 rather than the somewhat
disconcerting 0x8.0p-3.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGFGFw84KuGfSFAYARAgWdAJ0SVwMINjVcNctW7DjNkEEdBhnRbQCeK7wx
VvRKgbYfBxWerLeQ1vDYX+g=
=nEse
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]