This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Here's my attempt at all of the functions in the background of this. Feel free to criticize and carve it up like a Thanksgiving turkey. -- Gregory

On 3/3/2015 4:48 AM, Corinna Vinschen wrote:
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


Attachment: fabs.c
Description: Text document

Attachment: floor.c
Description: Text document

Attachment: matherr.c
Description: Text document

Attachment: setsign.c
Description: Text document

Attachment: trunc.c
Description: Text document

Attachment: xmath.h
Description: Text document

Attachment: fpclassify.c
Description: Text document

Attachment: getebits.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]