[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf-safe checks of invalid long double values
From: |
Pádraig Brady |
Subject: |
Re: printf-safe checks of invalid long double values |
Date: |
Fri, 28 Nov 2014 16:59:01 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 28/11/14 15:57, Paul Eggert wrote:
> Pádraig Brady wrote:
>
>> 1. Include the snprintf-posix gnulib module to fix this od issue,
>> (but that would also use the replacement code in many more cases).
>>
>> 2. Adjust gnulib's ftoastr() to use the lower level vasnprintf-posix.
>> That would work, though vasnprintf is not provided by glibc at all,
>> so perhaps a lower level glibc equivalent function is preferred.
>>
>> 3. Since glibc no longer crashes, and no-one has complained about
>> these edge cases of invalid numbers, just avoid this replacement altogether
>> but push for the improvement to output "nan" in these cases in glibc.
>
> Thanks, I like this option [3] the best.
BTW Looking a bit more into option 1, I see that snprintf isn't used
that much at all, though it is used in numfmt with %Lf and so we'd
need for other portability reasons to avoid that or use snprintf-posix
for that too. I'll look into avoiding that in numfmt.
Pádraig.