GNU bug report logs - #54785
for floating point, printf should use double like in C instead of long double

Previous Next

Package: coreutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Fri, 8 Apr 2022 09:18:01 UTC

Severity: normal

Full log


Message #35 received at 54785 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Golden <gdg <at> zplane.com>
Cc: 54785 <at> debbugs.gnu.org
Subject: Re: bug#54785: for floating point, printf should use double like in C
 instead of long double
Date: Wed, 27 Apr 2022 10:25:23 -0700
On 4/27/22 05:10, Glenn Golden wrote:
> Ok, I see what you mean, thanks for the explanation. I'll pose the question (or maybe file a bug report) on the glibc list.

By the way I now think I see a reason for why glibc does things the way 
it does: it minimizes output size.

'double' has 53 bits counting the hidden bit, and with 53/4 you have 13 
hex digits plus one leading digit that is either 0 (unnormalized) or 1 
(normalized).

'long double' has 64 bits and with 64/4 you have 16 hex digits, where 
the leading digit is 0-7 (unnormalized), 8-f (normalized).

Any proposal to change 'long double' to always output leading 0 or 1 
needs to deal with the fact that this'd lengthen the output string.




This bug report was last modified 3 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.