This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: printf("%.0f", 0.1) => 0.
- To: "Fifer, Eric" <EFifer at sanwaint dot com>
- Subject: Re: printf("%.0f", 0.1) => 0.
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Wed, 16 Aug 2000 14:20:40 -0400
- CC: "'cygwin-developers at sources dot redhat dot com'" <cygwin-developers at sources dot redhat dot com>, "'newlib at sources dot redhat dot com'" <newlib at sources dot redhat dot com>
- Organization: Red Hat Inc.
- References: <779F20BCCE5AD31186A50008C75D997917177B@silldn_mail1.sanwaint.com>
"Fifer, Eric" wrote:
>
> I discovered this when testing the latest Perl:
>
> main()
> {
> printf("%.0f\n", 0.1);
> printf("%.0f\n", -0.1);
> }
>
> Produces:
>
> 0.
> -0.
>
> The trailing dot is the problem. Attached is a suggested
> change that seems to fix the problem and not introduce any
> others.
>
> Regards,
>
> Eric Fifer
>
Patch has been applied to sourceware.
Thanks,
-- Jeff Johnston (Red Hat Inc.)