public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Errors in math function man pages
@ 2021-12-29  1:57 Keith Thompson
  2021-12-29  5:10 ` Brian Inglis
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Thompson @ 2021-12-29  1:57 UTC (permalink / raw)
  To: newlib; +Cc: Keith Thompson

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-29  5:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29  1:57 Errors in math function man pages Keith Thompson
2021-12-29  5:10 ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).