NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/56234: missing C99 frobs in <math.h>



>Number:         56234
>Category:       standards
>Synopsis:       missing C99 frobs in <math.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 04 18:35:00 +0000 2021
>Originator:     David A. Holland
>Release:        NetBSD 9.99.83 (20210604)
>Organization:
>Environment:
System: n/a
Architecture: n/a
Machine: n/a
>Description:

Crosschecking <math.h> against C99 7.12 shows that we are missing the
following items. (These are documented at the top of math.h, but there
should be a PR as well.)

(1)
    MATH_ERRNO (macro)
    MATH_ERREXCEPT (macro)
    math_errhandling (macro or constant)

This is supposed to document whether floating-point gaffes set errno
(MATH_ERRNO) or cause exceptions (MATH_ERREXCEPT) or both
(MATH_ERRNO|MATH_ERREXCEPT).

I would expect this to be machine-dependent; it probably makes sense
to put
   #define MATH_ERRNO 1
   #define MATH_ERREXCEPT 2
in math.h and a #define for math_errhandling in every machine/math.h,
but to actually do this we need to collect up the proper values for
each machine. It is probably a bad idea to add the macros for the
cases until we also have math_errhandling at least for major machines,
since if any code out there uses this logic at all (unclear) it's
probably guarded by #ifdef MATH_ERRNO.

(2)
    FP_FAST_FMA                                
    FP_FAST_FMAF                               
    FP_FAST_FMAL                               

These are supposed to be defined if fma{,f,l}() (fused multiply-add)
is preferable (or comparable) to separate multiply and add. This is
machine-dependent, and also, it's an instruction-set thing that the
compiler doubtless already knows; do gcc and/or clang provide backend
support we could hook up to?

>How-To-Repeat:
	n/a
>Fix:



Home | Main Index | Thread Index | Old Index