[cfp-interest 3550] Fwd: [SC22WG14.32508] The [[reproducible]] Example 3, §6.7.13.8.3
Jim Thomas
jaswthomas at sbcglobal.net
Fri Jul 18 17:19:10 PDT 2025
> Begin forwarded message:
>
> From: JeanHeyd Meneide <phdofthehouse at gmail.com>
> Subject: [SC22WG14.32508] The [[reproducible]] Example 3, §6.7.13.8.3
> Date: July 18, 2025 at 3:33:01 PM PDT
> To: wg14 <sc22wg14 at open-std.org>
>
> Hi Everybody,
>
> The C Floating Point group met during its May meeting and
> reviewed the use of [[reproducible]] in conjunction with this code
> snippet in the standard N3550 in EXAMPLE 3, §6.7.13.8.3:
>
> inline double distance (double const x[static 2]) [[reproducible]] {
> #pragma STDC FP_CONTRACT OFF
> #pragma STDC FENV_ROUND FE_TONEAREST
> // We assert that sqrt will not be called with invalid arguments
> // and the result only depends on the argument value.
> extern typeof(sqrt) [[unsequenced]] sqrt;
> return sqrt(x[0]*x[0] + x[1]*x[1]);
> }
>
> The problem, unfortunately, is that this is not enough to make it
> impossible to observe the effect of calling `sqrt` due to certain
> floating point exceptions / floating point flags. While there is a way
> in TS 18661-5 to turn off those flags from occurring with
>
> #pragma STDC FENV_EXCEPT FE_ALL_EXCEPT NO_FLAG
>
> That is not in the main text of the standard, and therefore is
> unusable. CFP's recommendation is to remove this snippet since the
> code is incorrect and cannot be made correct without invalidating the
> purpose of the example, and so I've done so.
>
> We are going to need a new example for a [[reproducible]]
> attribute, here. Preferably, something that shows its ability to be
> applied to functions; it could perhaps be used with a fixed-point
> bounding box collision test function, or something similar
> lightweight.
>
> Let me know if you have an idea or example for what could replace it.
>
> Sincerely,
> JeanHeyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250718/9e6996ed/attachment.htm>
More information about the cfp-interest
mailing list