Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

long double math library implementations?

What are the available portable implementations of the C99 long double math library functions (expl, cosl, logl, etc.), if any? I've looked in fdlibm (Sun-based), NetBSD (UCB-based), etc. sources and not seen them.

like image 478
R.. GitHub STOP HELPING ICE Avatar asked May 10 '11 04:05

R.. GitHub STOP HELPING ICE


2 Answers

You should be able to see it in the Sun-based libraries (used in pretty much all the open C libraries I am aware of, including glibc and FreeBSD one).

I generally prefer BSD code for math code (more readable IMO). See here for 80-bits (Intel) long double format. For a given function, different implementation/architectures may be in different directories.

One thing to realize is that long double is not standardized (more exactly, only since the 2008 rev of IEEE754, which is not really implemented in most common CPU yet). Which means each CPU requires a different implementation for a lot of stuff (IA32, AMD64, PPC, Alpha, Sparc are all different in that aspect...).

like image 200
David Cournapeau Avatar answered Oct 04 '22 23:10

David Cournapeau


Try the Cephes Mathematical Library.

like image 37
lhf Avatar answered Oct 04 '22 23:10

lhf