[cfp-interest 3415] Re: [SC22WG14.29708] powr(negative, qNaN)
Jim Thomas
jaswthomas at sbcglobal.net
Fri Mar 14 08:57:01 PDT 2025
I too think Joseph is correct about the intention for powr. Here’s a suggestion to make this intention explicit. In F.10.5.7, change:
powr(x, y) returns a NaN and raises the "invalid" floating-point exception for x < 0.
to:
powr(x, y) returns a NaN and raises the "invalid" floating-point exception for x < 0 and all y (including NaN).
The added words follow the style used in F.10.5.8 for rootn(x, 0).
- Jim Thomas
> On Mar 14, 2025, at 5:54 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
>
> On Thu, 13 Mar 2025 18:03:24 +0000 (UTC) Joseph Myers wrote:
>>
>> Do I understand correctly that powr(x, qNaN) should raise "invalid" for
>> negative x, since such x are outside the domain of the function as defined
>> in IEEE 754?
>>
>> The relevant statements in Annex F are
>>
>> "Functions with a NaN argument return a NaN result and raise no
>> floating-point exception, except where explicitly stated otherwise."
>>
>> and
>>
>> "powr(x, y) returns a NaN and raises the "invalid" floating-point
>> exception for x < 0."
>>
>> where the latter doesn't explicitly say "even if y is a NaN", unlike some
>> other cases such as rootn(qNaN, 0), where it's explicit that rootn(x, 0)
>> raises "invalid" for all x including NaN.
>>
>> IEEE 754 says
>>
>> "powr(x, y) signals the invalid operation exception for x < 0"
>>
>> and
>>
>> "powr(x, qNaN) is qNaN for x 0"
>>
>> as well as
>>
>> "Outside its domain an operation shall return a quiet NaN and signal the
>> invalid operation exception.".
>>
>> If my understanding of the intent is correct then I'll file this as an
>> issue that it should be more explicit that "invalid" is raised in this
>> case of a NaN argument.
>
> I agree with your understanding.
>
>
>
> ---
> Fred J. Tydeman Tydeman Consulting
> tydeman at tybor.com Testing, numerics, programming
> +1 (702) 608-6093 Vice-chair of INCITS/C (ANSI "C")
> Sample C17+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250314/b9149d33/attachment.htm>
More information about the cfp-interest
mailing list