RFA: Add ! LDBL_EQ_DBL implementations of cosl, sinl and tanl
Corinna Vinschen
vinschen@redhat.com
Tue Mar 3 11:23:00 GMT 2015
On Mar 2 13:18, Craig Howland wrote:
> On 03/02/2015 12:52 PM, Nick Clifton wrote:
> >Hi Jeff, Hi Corinna,
> >
> > Attached is a patch that implements cosl(), sinl() and tanl() when
> > long double is not the same as double. In the course of implementing
> > these functions I found that I also needed to implement the fabls()
> > and floorl() functions as well as several internal library support
> > routines.
> >
> > Tested in the usual way with an x86_64-linux-gnu toolchain with
> > direct linking to the math functions.
> >
> > OK to apply ?
> >
> >Cheers
> > Nick
> >
> >newlib/ChangeLog
> >2015-03-02 Nick Clifton <...>
> >
> > * libm/common/cosl.c (cosl): Add implementation for when long
> > double is not the same as double.
> > * libm/common/fabls.c (fabls): Likewise.
> > * libm/common/floorl.c (floorl): Likewise.
> > * libm/common/sinl.c (sinl): Likewise.
> > * libm/common/tanl.c (tanl): Likewise.
> > * libm/common/fdlibmh.h: Add prototypes for __ieee754_rem_pio2l,
> > __kernel_cosl, __kernel_cosl, __kernel_sinl and __kernel_tanl.
> > * libm/math/e_rem_pio2l.c: New file. Implements
> > __ieee754_rem_pio2l.
> > * libm/math/k_cosl.c: New file. Implements __kernel_cosl.
> > * libm/math/k_sinl.c: New file. Implements __kernel_sinl.
> > * libm/math/k_tanl.c: New file. Implements __kernel_tanl.
> > * libm/math/Makefile.am (src): Add k_cosl.c, k_sinl.c, k_tanl.c
> > and e_rem_pio2l.c.
> > * libm/math/Makefile.in: Regenerate.
First of all, thanks for this patch, Nick.
> math.h needs to be changed, too, to take the new routines out of the long
> double==double checks.
That's right, a math.h patch is missing.
> These routines are not fully C99/POSIX-compliant in terms of floating point
> exceptions and error returns if IEC 60559 is being used. (See, for example,
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/cosl.html, under
> the "MX" markings, for the error-return considerations.)
Neither are all our non-long double functions. Have a look at
libm/math/s_cos.c, for instance.
> Do we want to start out with this consideration missing? I would expect
> that the vast majority of people probably do not care about the floating
> point exception aspect. Setting errno, however, is quite a different
> question, for which I have no idea how to gauge interest.
Setting errno should be easy to add:
- cosl, sinl and tanl just need an extra check for Inf to set errno to
EDOM.
- tanl needs an extra check if the result of a non-Inf arg is Inf to
return ERANGE.
- fabsl doesn't define errors>
- floorl doesn't produce errors (see Linux man page),
Nick, any problem to add this?
However, that also means our long double functions will behave
differently than our non-long double functions. Is anybody willing to
making a sweep through our non-long double functions to add errno
setting where missing?
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20150303/ab87aff7/attachment.sig>
More information about the Newlib
mailing list