|
From: | Paul Eggert |
Subject: | 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 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |