Implement C23 pown [committed]
Florian Weimer
fweimer@redhat.com
Mon Jun 2 18:01:07 GMT 2025
* Carlos O'Donell:
> On 4/22/25 12:39 PM, Joseph Myers wrote:
>> On Mon, 14 Apr 2025, Florian Weimer wrote:
>>
>>> * Joseph Myers:
>>>
>>>> C23 adds various <math.h> function families originally defined in TS
>>>> 18661-4. Add the pown functions, which are like pow but with an
>>>> integer exponent. That exponent has type long long int in C23; it was
>>>> intmax_t in TS 18661-4, and as with other interfaces changed after
>>>> their initial appearance in the TS, I don't think we need to support
>>>> the original version of the interface. The test inputs are based on
>>>> the subset of test inputs for pow that use integer exponents that fit
>>>> in long long.
>>>
>>> The test current fails with IBM long double, see below.
>> For IBM long double, the trivial case applies:
>> #if M_MANT_DIG >= LLONG_WIDTH - 1
>> ret = M_SUF (__ieee754_pow) (x, y);
>> #else
>> So I think these are all either libgcc bugs in the conversion from
>> long
>> long to long double in non-default rounding modes (so should be XFAILed
>> with xfail-rounding:ibm128-libgcc / XFAIL_ROUNDING_IBM128_LIBGCC) or else
>> bugs in how the underlying powl handles particular arguments.
>>
>
> Sachin,
>
> Would you be able to look into XFAIL-ing these tests in your capacity as
> ppc64le machine maintainer?
>
> As Joseph notes these are likely XFAILs for IBM long double format.
We tried to review this today. I think what you are asking here is to
adjust the subtests in math/libm-test-pown.inc that fail. For example,
the last one from these
/* pown (-inf, y) == -inf for y an odd integer > 0. */
TEST_fL_f (pown, minus_infty, 27, minus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0xffffff, minus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0x1fffffe, plus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0x1fffffffffffffLL, minus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0x3ffffffffffffeL, plus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0x7ffffffffffffffeLL, plus_infty, ERRNO_UNCHANGED),
TEST_fL_f (pown, minus_infty, 0x7fffffffffffffffLL, minus_infty, ERRNO_UNCHANGED),
results in:
testing long double (without inline functions)
infinity has wrong sign.
Failure: Test: pown_downward (-inf, 0x7fffffffffffffffLL)
Result:
is: inf inf
should be: -inf -inf
I believe this subtest needs to be changed to:
TEST_fL_f (pown, minus_infty, 0x7fffffffffffffffLL, minus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC),
Carlos, is that what you expect Sachin to do?
Thanks,
Florian
More information about the Libc-alpha
mailing list