RFA: Add ! LDBL_EQ_DBL implementations of cosl, sinl and tanl

Craig Howland howland@LGSInnovations.com
Tue Mar 3 09:11:00 GMT 2015


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  <nickc@redhat.com>
>
> 	* 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.
>
math.h needs to be changed, too, to take the new routines out of the long 
double==double checks.

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.)

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.

Craig



More information about the Newlib mailing list