This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH v4 2/3] Add default implementation of fenv.h and all methods
- From: Joel Sherrill <joel at rtems dot org>
- To: "Howland, Craig D. - US" <craig dot howland at caci dot com>
- Cc: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Thu, 8 Aug 2019 10:11:57 -0500
- Subject: Re: [PATCH v4 2/3] Add default implementation of fenv.h and all methods
- References: <1565194471-21861-1-git-send-email-joel@rtems.org> <1565237528222.64280@caci.com>
- Reply-to: joel at rtems dot org
I am sending a patch which I think addresses all of these. I am not
bothering to send
the regeneration patch again.
And no one has explained why some files under libc change when I regenerate.
--joel
On Wed, Aug 7, 2019 at 11:12 PM Howland, Craig D. - US via newlib <
newlib@sourceware.org> wrote:
> I think I have identified all of the individual places where return values
> should be 0 as Joseph Myers noted in general, as well as some other small
> items.
> Craig
>
> > From: newlib-owner@sourceware.org <newlib-owner@sourceware.org> on
> behalf of Joel Sherrill <joel@rtems.org>
> > Sent: Wednesday, August 7, 2019 12:14 PM
> > To: newlib@sourceware.org
> > Cc: Joel Sherrill
> > Subject: [PATCH v4 2/3] Add default implementation of fenv.h and all
> methods
> >
> > The default implementation of the fenv.h methods return
> > -EOPNOTSUPP.
> [typo:] -ENOTSUP
> >
> > The intention of the new fenv.h is that it be portable
> > and that architectures provide their own implementation
> > of sys/fenv.h.
> > ---
> > ...
>
> > diff --git a/newlib/libm/fenv/feclearexcept.c
> b/newlib/libm/fenv/feclearexcept.c
> > new file mode 100644
> > +int feclearexcept(int excepts)
> > +{
> > + return -ENOTSUP;
> return (excepts ? -ENOTSUP : 0);
> > ...
>
> > diff --git a/newlib/libm/fenv/fegetround.c
> b/newlib/libm/fenv/fegetround.c
> > ...
> > +FUNCTION
> > +<<fegetround>>---get current rounding direction
> > +
> > +INDEX
> > + feclearexcept
> [typo, not feclearexcept:] fegetround
> > +SYNOPSIS
> > + #include <fenv.h>
> > + int fegetround(void);
> > +
> > + Link with -lm.
> > +
> > +DESCRIPTION
> > +This method returns the current rounding direction.
> > +
> > +RETURNS
> > +This method returns the rounding direction. If the current rounding
> > +direction cannot be determined, then a negative value is returned.
> [Small edit, pointing out macro value needed:]
> This method returns the rounding direction, corresponding to the value
> of the respective rounding macro. If the current rounding
> direction cannot be determined, then a negative value is returned.
> > ...
>
> > diff --git a/newlib/libm/fenv/feraiseexcept.c
> b/newlib/libm/fenv/feraiseexcept.c
> > ...
> > +int feraiseexcept(int excepts)
> > +{
> > + return -ENOTSUP;
> return (excepts ? -ENOTSUP : 0);
> > +}
> > ...
>
> > diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c
> > ...
> > +SYNOPSIS
> > + #include <fenv.h>
> > + int fesetenv(const fenv_t *[<envp>]);
> > +
> > + Link with -lm.
> > +
> > +DESCRIPTION
> > +This method attempts to establish the floating-point environment
> > +pointed to by <[envp]>. The argument [<envp>] must point to a
> > +floating-point environment obtained via <<fegetenv>> or <<feholdexcept>>
> > +or a floating-point environment macro such as <<FE_DFL_ENV>>.
> [Add:]
> It only sets the states of the flags as recorded in its argument, and
> does not actually raise the associated floating-point exceptions.
> > ...
>
> > diff --git a/newlib/libm/fenv/fesetround.c
> b/newlib/libm/fenv/fesetround.c
> > ...
> > +SYNOPSIS
> > + #include <fenv.h>
> > + int fesetround(int <[round]>);
> > +
> > + Link with -lm.
> > +
> > +DESCRIPTION
> > +This method attempts to set the current rounding direction represented
> > +by <[round]>.
> [Add:]
> <[round]> must be the value of one of the rounding-direction macros.
> > ...
>
> > diff --git a/newlib/libm/fenv/fetestexcept.c
> b/newlib/libm/fenv/fetestexcept.c
> > ...
> > +int fetestexcept(int excepts)
> > +{
> > + return -ENOTSUP;
> return 0;
> > ...
>