public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Joel Sherrill <joel@rtems.org>
To: "Howland, Craig D. - US" <craig.howland@caci.com>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: [PATCH v3 2/3] Add default implementation of fenv.h and all methods
Date: Wed, 07 Aug 2019 13:29:00 -0000	[thread overview]
Message-ID: <CAF9ehCXw2QNdGSg0sxGykeqX-0CAejq1jq4k-Egj7WDeA3-VQA@mail.gmail.com> (raw)
In-Reply-To: <1565184419338.12435@caci.com>

On Wed, Aug 7, 2019 at 8:27 AM Howland, Craig D. - US via newlib <
newlib@sourceware.org> wrote:

>
> > From: newlib-owner@sourceware.org <newlib-owner@sourceware.org> on
> behalf of Corinna Vinschen <vinschen@redhat.com>
> > Sent: Wednesday, August 7, 2019 4:36 AM
> > To: Joel Sherrill
> > Cc: newlib@sourceware.org
> > Subject: Re: [PATCH v3 2/3] Add default implementation of fenv.h and all
> methods
> >
> > Hi Joel,
> >
> > On Aug  6 14:13, Joel Sherrill wrote:
> > > [...]
> > > +//#define FE_DIVBYZERO 0x00000001
> > > +//#define FE_INEXACT   0x00000002
> > > +//#define FE_INVALID   0x00000004
> > > +//#define FE_OVERFLOW  0x00000008
> > > +//#define FE_UNDERFLOW 0x00000010
> > > +
> > > +//#define FE_ALL_EXCEPT \
> > > +
> //(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW)
> > > +#define FE_ALL_EXCEPT 0      /* NONE SUPPORTED IN PLACEHOLDER
> TEMPLATE */
> > > +
> > > +/*
> > > + * The following macros are to be defined if the respective rounding
> > > + * direction is supported by the implementation via the fegetround()
> and
> > > + * fesetround() functions, each with a unique positive value.
> > > + *
> > > + *   FE_DOWNWARD
> > > + *   FE_TONEAREST
> > > + *   FE_TOWARDZERO
> > > + *   FE_UPWARD
> > > + *
> > > + * Other implementation-specific rounding modes may be defined, and
> must start
> > > + * with FE_ followed by a capital letter.
> > > + */
> > > +//#define FE_DOWNWARD        1
> > > +//#define FE_TONEAREST       2
> > > +//#define FE_TOWARDZERO      3
> > > +//#define FE_UPWARD          4
> > > +
> > > +/*
> > > + * The following typedefs are required. See the C and POSIX standards
> for
> > > + * details:
> > > + *
> > > + *   fenv_t
> > > + *   fexcept_t
> > > + */
> > > +typedef size_t fenv_t;
> > > +typedef size_t fexcept_t;
> >
> > While these types are defined, the above macros are not.  Wouldn't
> > it make sense to define all or nothing by default?
> >
> The standards require the types to be defined, but the individual macros
> are to be defined only if supported by the implementation.  The
> default implementation being provided supports nothing, only
> returning error, so it is proper for them to not be defined.  But having
> them there commented out to serve as a template seems to be a good thing.
>

Quick reply. :)

This is the POSIX language:

"The *<fenv.h>* header shall define the following constants if and only if
the implementation supports the floating-point exception by means of the
floating-point functions *feclearexcept*()
<https://pubs.opengroup.org/onlinepubs/009695399/functions/feclearexcept.html>
, *fegetexceptflag*()
<https://pubs.opengroup.org/onlinepubs/009695399/functions/fegetexceptflag.html>
, *feraiseexcept*()
<https://pubs.opengroup.org/onlinepubs/009695399/functions/feraiseexcept.html>
, *fesetexceptflag*()
<https://pubs.opengroup.org/onlinepubs/009695399/functions/fesetexceptflag.html>,
and *fetestexcept*()
<https://pubs.opengroup.org/onlinepubs/009695399/functions/fetestexcept.html>.
Each expands to an integer constant expression with values such that
bitwise-inclusive ORs of all combinations of the constants result in
distinct values."

I don't mind changing size_t to int. That seems reasonable

--joel

>
> >
> > Thanks,
> > Corinna
> Craig

  reply	other threads:[~2019-08-07 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 19:13 [PATCH v3 0/3] fenv stubs and documentation series Joel Sherrill
2019-08-06 19:13 ` [PATCH v3 3/3] Regenerated files from fenv.h addition Joel Sherrill
2019-08-06 19:13 ` [PATCH v3 1/3] Miscellaneous Makefile.in regenerated Joel Sherrill
2019-08-06 19:13 ` [PATCH v3 2/3] Add default implementation of fenv.h and all methods Joel Sherrill
2019-08-07  8:36   ` Corinna Vinschen
2019-08-07 13:27     ` Howland, Craig D. - US via newlib
2019-08-07 13:29       ` Joel Sherrill [this message]
2019-08-08  0:01         ` Brian Inglis
2019-08-08  3:24           ` Howland, Craig D. - US via newlib

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=CAF9ehCXw2QNdGSg0sxGykeqX-0CAejq1jq4k-Egj7WDeA3-VQA@mail.gmail.com \
    --to=joel@rtems.org \
    --cc=craig.howland@caci.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).