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


View this message in rfc822 format

From: Chet Ramey <chet.ramey <at> case.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: vincent <at> vinc17.net, 54785 <at> debbugs.gnu.org, bug-bash <at> gnu.org, chet.ramey <at> case.edu
Subject: bug#54785: for floating point, printf should use double like in C instead of long double
Date: Mon, 25 Apr 2022 14:22:26 -0400
On 4/25/22 11:03 AM, Paul Eggert wrote:
> On 4/11/22 11:52, Chet Ramey wrote:
>> On 4/9/22 3:31 PM, Paul Eggert wrote:
> 
>> It sounds like there are three cases.
>>
>> 1. If the `L' modifier is supplied, as an extension (POSIX doesn't allow
>>     length modifiers for the printf utility), use long double. This would
>>     work in both default and posix modes.
>>
>> 2. In posix mode, use strtod() and double.
>>
>> 3. In default mode, use the existing code to get the highest possible
>>     precision, as the code has done for over 20 years.
> 
> That'll fix the POSIX compatibility bug. However, it may be better for Bash 
> to just do (1) if 'L' is supplied and (2) otherwise, even if this is less 
> precise than (3). Doing it this simpler way will likely be more useful for 
> the small number of people who care whether 'printf' uses 'double' or 'long 
> double' internally (and nobody else will care).

Thanks for the input.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet <at> case.edu    http://tiswww.cwru.edu/~chet/




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.