public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Keith Thompson <Keith.S.Thompson@gmail.com>
To: newlib@sourceware.org
Cc: Keith Thompson <Keith.S.Thompson@gmail.com>
Subject: Errors in math function man pages
Date: Tue, 28 Dec 2021 17:57:05 -0800	[thread overview]
Message-ID: <CAAHpriPN9HkBveXBU9hFCPooZRKbsfiu=+oPbGh+AbgHfGvSeA@mail.gmail.com> (raw)

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

             reply	other threads:[~2021-12-29  1:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29  1:57 Keith Thompson [this message]
2021-12-29  5:10 ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAHpriPN9HkBveXBU9hFCPooZRKbsfiu=+oPbGh+AbgHfGvSeA@mail.gmail.com' \
    --to=keith.s.thompson@gmail.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).