Use of C99 extra long double math functions after r236148

Peter Jeremy peter at rulingia.com
Mon May 28 22:04:46 UTC 2012


On 2012-May-28 13:31:59 -0700, Steve Kargl <sgk at troutmask.apl.washington.edu> wrote:
>On Mon, May 28, 2012 at 11:01:24AM -0500, Stephen Montgomery-Smith wrote:
>> One thing that could be done is to have a "math/cephes" port that adds 
>> the extra C99 math functions.  This is already done in the math/sage 
>> port, using a rather clever patch due to Peter Jeremy, that applies to 
>> the cephes code.
...
>This is a horrible, horrible, horrible idea.  Have you
>looked at the cephes code, particularly the complex.h
>functions?

The cephes code is somewhat a mess layout-wise.  Algorithmetically,
it seems somewhat variable - some functions are implemented (hopefully
correctly) using semi-numerical techniques, whereas others just use
mathematical identities which will result in precision loss - though
most of the functions include accuracy information.

I agree it would be far preferable to have a properly validated C99
libm with all functions having maximum errors of a no more than a few
LSB over their complete domain, as well as correct support for signed
zeroes, infinities and signalling and non-signalling NaNs but that is
a non-trivial undertaking.

In the interim, how should FreeBSD handle apps that want a C99 libm?
1) Fail to build them
2) Provide possibly imperfect fallbacks for the unimplemented bits.

If someone (I don't have the expertise) wants to identify the cephes
functions that are sub-standard, we can include link-time warnings
(as done for eg gets(3)) when they are used.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20120528/8d6b4428/attachment.pgp


More information about the freebsd-current mailing list