Errors in math function man pages
Keith Thompson
Keith.S.Thompson@gmail.com
Wed Dec 29 01:57:05 GMT 2021
There are two errors in the sqrt(3) man page, with similar errors in
the man pages for most or all of the other math functions specified
in <math.h>. The math functions are implemented correctly as far as
I can tell, but the man pages are out of date, reflecting the language
as of the 1989 ANSI / 1999 ISO C standard.
C89/C90 defined math functions only for type double, but C99 and
later added corresponding functions for float and long double (with
'f' and 'l' suffixes), and also introduced a number of new functions.
Using sqrt(3) man page as an example, it mentions sqrt and sqrtf,
but does not mention sqrtl.
Second, it says:
> sqrt is ANSI C. sqrtf is an extension.
That was true as of C89/C89, but sqrt, sqrtf, and sqrtl are all defined
by ISO C 1999 and later. (And I suggest referring to "ISO C" rather
than the ambiguous "ANSI C".)
The same problem appears in most or all of the man pages for functions
declared in <math.h>.
Another example: the man page for asinh (inverse hyperbolic sine) says:
> Neither asinh nor asinhf are ANSI C.
As of C99 and later, asinh, asinhf, and asinhl are all ISO C.
I *think* this is the list of source files that would need to corrected
to bring the man pages up to date:
newlib/libm/math/s_asinh.c
newlib/libm/math/s_atan.c
newlib/libm/math/s_erf.c
newlib/libm/math/s_sin.c
newlib/libm/math/s_tanh.c
newlib/libm/math/w_acosh.c
newlib/libm/math/w_atan2.c
newlib/libm/math/w_atanh.c
newlib/libm/math/w_exp.c
newlib/libm/math/w_fmod.c
newlib/libm/math/w_gamma.c
newlib/libm/math/w_hypot.c
newlib/libm/math/w_log10.c
newlib/libm/math/w_pow.c
newlib/libm/math/w_sinh.c
newlib/libm/math/w_sqrt.c
newlib/libm/mathfp/e_acosh.c
newlib/libm/mathfp/e_atanh.c
newlib/libm/mathfp/e_hypot.c
newlib/libm/mathfp/er_lgamma.c
newlib/libm/mathfp/s_asinh.c
newlib/libm/mathfp/s_atan.c
newlib/libm/mathfp/s_atan2.c
newlib/libm/mathfp/s_atangent.c
newlib/libm/mathfp/s_erf.c
newlib/libm/mathfp/s_exp.c
newlib/libm/mathfp/s_fmod.c
newlib/libm/mathfp/s_log10.c
newlib/libm/mathfp/s_pow.c
newlib/libm/mathfp/s_sine.c
newlib/libm/mathfp/s_sineh.c
newlib/libm/mathfp/s_sqrt.c
newlib/libm/mathfp/s_tanh.c
More information about the Newlib
mailing list