[cfp-interest 3561] Re: C23 possible defect: output bounds of imprecise math functions
Jim Thomas
jaswthomas at sbcglobal.net
Sat Aug 9 16:18:20 PDT 2025
The issue for CFP is what to do about C specification that might be inconsistent with correct rounding, like 7.12.5.2 #3:
The asin functions return arcsin x in the interval [−pi/2, +pi/2] radians.
I think the purpose of the range qualification should be to identify the primary branch of the multivalued mathematical function, not to strictly bound the range of the library function.
- Jim Thomas
> On Aug 9, 2025, at 3:39 PM, Jim Thomas <jaswthomas at sbcglobal.net> wrote:
>
> Paul,
>
> Thanks for the correction!
>
> Note that ISO/IEC 60559 9.2.1 says
>
> For some formats under some rounding attributes the rounded magnitude range of atan (atan2) might exceed the unrounded magnitude of π/2 (π). A programmer must then take care to properly handle any anomalous manifold jump that might occur under the inverse operation.
>
> prioritizing correct rounding over range bounds. I’m not aware of any place that ISO/IEC 60559 makes an exception to correct rounding for its floating-point operation to preserve a property of the corresponding mathematical operation.
>
> - Jim
>
>
>> On Jul 18, 2025, at 11:36 PM, Paul Zimmermann <Paul.Zimmermann at inria.fr> wrote:
>>
>>> Correctly rounded functions, e.g. sqrt(x) per Annex F, won’t return out-of-range values. C reserves cr_ prefixed names for correctly rounded math functions.
>>
>> however correct rounding is not always compatible with range constraints,
>> see the example in section 6.4 from https://dl.acm.org/doi/pdf/10.1145/3747840.
>>
>> Maybe the CFP group might decide what to do in that case.
>>
>> Paul
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250809/ce8cb20e/attachment.htm>
More information about the cfp-interest
mailing list