From: Nathaniel Shead <nathanieloshead@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
Date: Mon, 20 Feb 2023 22:57:28 +1100 [thread overview]
Message-ID: <CACEF2k63F8MgRZK0w05p4oCbP1fJx7=BzyQSzr6VMt8btvdFOQ@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4kwxaEH0e4eceR0WRCCzB3rohFw_9_jax7tXcHs4xtSUg@mail.gmail.com>
On Mon, Feb 20, 2023 at 10:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 20 Feb 2023 at 11:23, Nathaniel Shead via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > The comments on PR79700 mentioned that it was somewhat ambiguous whether
> > these functions were supposed to exist for C++11 or not. I chose to add
> > them there, since other resources (such as cppreference) seem to think
> > that C++11 should be the standard these functions were introduced, and I
> > don't know of any reason to do otherwise.
> >
> > Tested on x86_64-linux.
>
> Thanks for the patch, but this needs tests for the new declarations
> (which are tedious to write, which is the main reason I haven't
> already pushed my own very similar patch).
>
Ah OK, fair enough. Where should the tests go? The only tests I could
find for the existing (non -f/l) functions was just tests for their
existence in testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
which I just added the new functions to - I guess I'll add a new file
here and test that all the functions can be called and give the same
results as the relevant overloaded variants?
>
> >
> > -- 8< --
> >
> > This patch adds the -f and -l variants of the C89 <math.h> functions to
> > <cmath> under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11
> > and up.
> >
> > libstdc++-v3/ChangeLog:
> >
> > PR libstdc++/79700
> > * include/c_global/cmath (acosf, acosl, asinf, asinl, atanf,
> > atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl,
> > expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf,
> > frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff,
> > modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf,
> > tanl, tanhf, tanhl): Add aliases in namespace std.
> > * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
> > Add checks for existence of above names.
> >
> > Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
> > ---
> > libstdc++-v3/include/c_global/cmath | 111 ++++++++++++++++++
> > .../headers/cmath/functions_std_c++17.cc | 45 +++++++
> > 2 files changed, 156 insertions(+)
> >
> > diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
> > index 568eb354c2d..eaebde33dee 100644
> > --- a/libstdc++-v3/include/c_global/cmath
> > +++ b/libstdc++-v3/include/c_global/cmath
> > @@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >
> > #if __cplusplus >= 201103L
> >
> > +#undef acosf
> > +#undef acosl
> > +#undef asinf
> > +#undef asinl
> > +#undef atanf
> > +#undef atanl
> > +#undef atan2f
> > +#undef atan2l
> > +#undef ceilf
> > +#undef ceill
> > +#undef cosf
> > +#undef cosl
> > +#undef coshf
> > +#undef coshl
> > +#undef expf
> > +#undef expl
> > +#undef fabsf
> > +#undef fabsl
> > +#undef floorf
> > +#undef floorl
> > +#undef fmodf
> > +#undef fmodl
> > +#undef frexpf
> > +#undef frexpl
> > +#undef ldexpf
> > +#undef ldexpl
> > +#undef logf
> > +#undef logl
> > +#undef log10f
> > +#undef log10l
> > +#undef modff
> > +#undef modfl
> > +#undef powf
> > +#undef powl
> > +#undef sinf
> > +#undef sinl
> > +#undef sinhf
> > +#undef sinhl
> > +#undef sqrtf
> > +#undef sqrtl
> > +#undef tanf
> > +#undef tanl
> > +#undef tanhf
> > +#undef tanhl
> > +
> > + using ::acosf;
> > + using ::acosl;
> > +
> > + using ::asinf;
> > + using ::asinl;
> > +
> > + using ::atanf;
> > + using ::atanl;
> > +
> > + using ::atan2f;
> > + using ::atan2l;
> > +
> > + using ::ceilf;
> > + using ::ceill;
> > +
> > + using ::cosf;
> > + using ::cosl;
> > +
> > + using ::coshf;
> > + using ::coshl;
> > +
> > + using ::expf;
> > + using ::expl;
> > +
> > + using ::fabsf;
> > + using ::fabsl;
> > +
> > + using ::floorf;
> > + using ::floorl;
> > +
> > + using ::fmodf;
> > + using ::fmodl;
> > +
> > + using ::frexpf;
> > + using ::frexpl;
> > +
> > + using ::ldexpf;
> > + using ::ldexpl;
> > +
> > + using ::logf;
> > + using ::logl;
> > +
> > + using ::log10f;
> > + using ::log10l;
> > +
> > + using ::modff;
> > + using ::modfl;
> > +
> > + using ::powf;
> > + using ::powl;
> > +
> > + using ::sinf;
> > + using ::sinl;
> > +
> > + using ::sinhf;
> > + using ::sinhl;
> > +
> > + using ::sqrtf;
> > + using ::sqrtl;
> > +
> > + using ::tanf;
> > + using ::tanl;
> > +
> > + using ::tanhf;
> > + using ::tanhl;
> > +
> > #ifdef _GLIBCXX_USE_C99_MATH_TR1
> >
> > #undef acosh
> > diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > index 3b4ada1a756..c6ec636c183 100644
> > --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > @@ -44,6 +44,51 @@ namespace gnu
> > using std::tan;
> > using std::tanh;
> >
> > + using std::acosf;
> > + using std::acosl;
> > + using std::asinf;
> > + using std::asinl;
> > + using std::atanf;
> > + using std::atanl;
> > + using std::atan2f;
> > + using std::atan2l;
> > + using std::ceilf;
> > + using std::ceill;
> > + using std::cosf;
> > + using std::cosl;
> > + using std::coshf;
> > + using std::coshl;
> > + using std::expf;
> > + using std::expl;
> > + using std::fabsf;
> > + using std::fabsl;
> > + using std::floorf;
> > + using std::floorl;
> > + using std::fmodf;
> > + using std::fmodl;
> > + using std::frexpf;
> > + using std::frexpl;
> > + using std::ldexpf;
> > + using std::ldexpl;
> > + using std::logf;
> > + using std::logl;
> > + using std::log10f;
> > + using std::log10l;
> > + using std::modff;
> > + using std::modfl;
> > + using std::powf;
> > + using std::powl;
> > + using std::sinf;
> > + using std::sinl;
> > + using std::sinhf;
> > + using std::sinhl;
> > + using std::sqrtf;
> > + using std::sqrtl;
> > + using std::tanf;
> > + using std::tanl;
> > + using std::tanhf;
> > + using std::tanhl;
> > +
> > using std::assoc_laguerre;
> > using std::assoc_laguerref;
> > using std::assoc_laguerrel;
> > --
> > 2.34.1
> >
>
next prev parent reply other threads:[~2023-02-20 11:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 11:23 Nathaniel Shead
2023-02-20 11:30 ` Jonathan Wakely
2023-02-20 11:57 ` Nathaniel Shead [this message]
2023-02-20 12:08 ` Jonathan Wakely
2023-02-21 11:22 ` Nathaniel Shead
2023-04-17 8:10 ` [Ping][PATCH] " Nathaniel Shead
2023-04-18 8:47 ` Jonathan Wakely
2023-05-17 8:37 ` Nathaniel Shead
2023-05-17 9:05 ` Jonathan Wakely
2023-05-17 9:38 ` Nathaniel Shead
2023-05-17 10:07 ` Jonathan Wakely
2023-11-11 0:43 ` Jonathan Wakely
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='CACEF2k63F8MgRZK0w05p4oCbP1fJx7=BzyQSzr6VMt8btvdFOQ@mail.gmail.com' \
--to=nathanieloshead@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.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).