I have to work with some (semi-)automatical verification software (CBMC (link)) which is statically working on C sources. Floating point is supported, but there are no definitions for all the mathematical functions. The attempt is to check, if it's possible to check numerical software with it.
So I need these functions. I'm looking for some math.h
definitions without co-processor use (e.g. sqrt
, pow
, remainder, tan
; int
/float
/double
).
When I looked for it in a libc shipped with some linux distributions (maybe now eglibc), I always reached a point, where there are some processor-intrinsics meaning a hardware sqrt-function for example.
What I need is a library supporting mathematical functions with the following characteristics:
Until now, I searched a bit for various libc implementations, especially ones regarding embedded systems. I think most of these libraries are targeting portability and size of compiled programs, but hard to tell if they are using processor-specific instructions.
Could someone give me a short introduction to the structure of these math libraries. How do they dispatch the various versions (e.g. a specific co-processor)?
And what are the meaning of these different prefixes in the filenames. e_sqrt.c
, k_sin
, s_sin
?
I would be happy to hear about some libraries which could be useful for me. I would prefer to take a library as it comes, but when it is necessary, it is also possible to look for some single function implementations and build up a small library. I won't use all of the functions defined in math.h.
This and this SO-posts are saying that the Java Math Implementation is/was based on fdlibm which sounds that this library is the way to go. Anyone with more information about this library I should know?
Seems that I have many possibilities including the following two:
There's a full software implementation of IEEE-754 in glibc/sysdeps/ieee754. When you compile the library it might automatically substitute in an architecture specific version (eg ia64/fpu/e_acosf.S
) of some function, but the entire library is implemented in software as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With