[cfp-interest 3688] Re: strtodN
Jim Thomas
jaswthomas at sbcglobal.net
Tue Oct 28 11:11:18 PDT 2025
We discussed this at the last CFP meeting. My thought was that “conversion” in 7.25.2.7 #5 refers to the conversion mentioned in #2 and that #2 would be the right place to add “in the return type of the function”:
-----
Then, they attempt to convert the subject sequence to a floating-point number in the return type of the function, and return the result.
-----
If done, the exact same change should be made in the last sentences in #2 in 7.25.2.6 (strtod), 7.33.4.2.2 (wcstod), and 7.33.4.2.3 (wcstodN).
The result of the rushed discussion was for me to add this to the list as a low priority issue to be addressed when time permitted.
A further thought:
C generally speaks of conversion to a result type. We might point out the omission in these cases to the C editor, affirm that conversion to the return type of the function is what is intended, and suggest the aforementioned changes.
Beyond style, just saying "convert … to a floating-point number" could be misunderstood to be referring to an intermediate result, particularly when converting a subject sequence in the decimal form with strtodN or converting a subject sequence in the hexadecimal form with strtod. One might think it to mean: convert the subject sequence to a floating-point number with whatever range and precision the implementation decides is suitable. Fred suggested in CFP 3602 that it might be (mistakenly) thought to mean: convert to the format given by the evaluation method macro.
Without evidence that this is a problem for users, it’s low priority for CFP. However, it does seem like something the editor would want to fix.
- Jim Thomas
> On Sep 24, 2025, at 4:26 PM, Fred Tydeman <tydeman.fred at gmail.com> wrote:
>
> On Thu, Sep 25, 2025 at 5:13 AM Jim Thomas <jaswthomas at sbcglobal.net <mailto:jaswthomas at sbcglobal.net>> wrote:
>>
>>
>> > On Sep 17, 2025, at 8:33 PM, Fred J. Tydeman <tydeman at tybor.com <mailto:tydeman at tybor.com>> wrote:
>> >
>> > C23: (N3219)
>> >
>> > 7.24.1.6 The strtodN functions
>> >
>> > 5 If the subject sequence has the expected form for a decimal
>> > floating-point number, the value resulting from the conversion is
>> > correctly rounded and the coefficient c and the quantum exponent q are
>> > determined by the rules in 6.4.4.3 for a decimal floating constant of
>> > decimal type.
>
> Is it worth adding after "correctly rounded"
> (to the return type of the function)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20251028/f6552d7f/attachment.htm>
More information about the cfp-interest
mailing list