long double math library implementations?

谁说胖子不能爱 提交于 2019-12-10 04:20:40

问题


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.


回答1:


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




回答2:


Try the Cephes Mathematical Library.



来源:https://stackoverflow.com/questions/5945129/long-double-math-library-implementations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!