[cfp-interest 3863] Re: What is a mathematical library fumctiom?
Jim Thomas
jaswthomas at sbcglobal.net
Sat Apr 11 10:38:04 PDT 2026
To what does “library functions” in F.10.1 refer to? I answered this question incorrectly in a previous email in this thread.
Here is relevant text from N3685:
F.8.7
1 Operations defined in 6.5.1 and functions and macros defined for the standard libraries change
floating-point status flags and control modes just as indicated by their specifications (including
conformance to ISO/IEC 60559). They do not change flags or modes (so as to be detectable by the
user) in any other cases.
F.10 Mathematics <math.h> and <tgmath.h>
F.10.1 General
…
10 Whether or when library functions not listed in Table F.2 raise the “inexact" floating-point exception
is unspecified, unless stated otherwise.
11 Whether or when library functions not listed in Table F.2 raise a spurious "underflow" floating-point
exception is not specified by this annex.450)
12 As implied by F.8.7, library functions do not raise spurious "invalid", "overflow", or "divide-by-zero"
floating-point exceptions (detectable by the user).
F.8.7 applies to all functions in the standard libraries: these functions change modes and flags only as specified. This allows standard library functions to be used without their contaminating the floating-point environment.
Normally in F.10, “functions” refers to <math.h> functions as indicated by the subclause title.
F.10.1 #10 is intended to apply to <math.h> functions not listed in Table 2: these functions have no requirements regarding “inexact”, unless stated otherwise. It is not intended to apply to all functions in the standard libraries. Suggest: change “library functions not listed in table F.2” to “<math.h> functions not listed in Table 2”.
F.10.1 #11 is intended to apply to <math.h> functions not listed in Table 2: Annex F does not restricted these functions from raising spurious “underflow”. (7.12.2 does imply some restriction, per footnote 408.) This override of F.8.7 is not intended to apply to all functions in the standard libraries. Suggest: change “library functions not listed in table F.2” to “<math.h> functions not listed in Table 2”.
F.10.1 #12 is just informational. It is intended to note for completeness that <math.h> functions not listed in Table 2 do not raise spurious “invalid”, “overflow”, or “divide-by-zero”--as implied by F.8.7. However, the statement is true all functions in the standard libraries. Suggest: change “library functions” to "functions in the standard libraries, including <math.h>”.
Related info ...
Annex F interest in standard library functions extends beyond <math.h> and <tgmath.h> in these two ways:
1. The ISO/IEC 60559 binding in F.3 includes functions in other standard library headers:
<stdlib.h>: strtod, strfromd
<stdio.h>: printf, scanf
<wchar.h>: wcstod, wscanf, wprinf
For these functions, F.5 supplements their subclauses in Clause 7 to specify them as ISO/IEC 60559 operations.
<string.h>: memcpy, memmove
F.8.7 #1 supplements their general specification in 7.28.
<fenv.h>: feclearexcept, fesetexcept, fetestexcept, fetestexceptflag, fesetexceptflag, fegetexceptflag, fegetround, fesetround, fegetmode, fesetmode
F.8 supplements their general specification in 7.6.
2. For the floating-point environment to be broadly usable, all library functions (in all standard headers) need to refrain from polluting it. This is covered by F.8.7 #1.
- Jim Thomas
> On Nov 20, 2025, at 5:22 PM, Damian McGuckin <damianm at esi.com.au> wrote:
>
> On Thu, 20 Nov 2025, Jim Thomas wrote:
>
>> ?Library functions? here is intended to apply to all the standard libraries, not (as the F.10 title suggests) just <math.h> and <tgmath.h>.
>
> Why does it appear in a section about Mathematical library functions?
> It is not obvious that it applies to "all".
>
>> There?s no reference to ?mathematical library functions?.
>
> The way I read F.10.1#1, it is implied. I know I am not alone.
>
> Somewhere that needs to be clarified. What words do you suggest?
>
> Thanks - Damian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20260411/bfdd900d/attachment-0001.htm>
More information about the cfp-interest
mailing list