JuliaMath / openlibm

High quality system independent, portable, open source libm implementation
https://openlibm.org
Other
507 stars 139 forks source link

Portability to software implementations of FP #263

Closed cesss closed 2 years ago

cesss commented 2 years ago

Considering the anarchy in the meaning of "long double" across different OSs and compilers (which is really sad), I find it highly desirable to overcome this sad situation by being able to choose a software implementation of IEEE 754 when you wish to use a certain precision in systems/compilers that don't support it natively (ie: in situations where you value precision more than performance). For example, John Hauser's SoftFloat library is a software implementation of IEEE 754 16/32/64/80/128 bit floating point types.

Reading that openlibm mentions portability as one of it goals, I felt like I found what I was looking for (ie: a libm implementation which I could build on top of the SoftFloat library, at least for the 80bit and the 128bit types), but taking a look at the source, I'm not sure if it's straightforward or not.

Well, one point of course is that C cannot overload arithmetic operators, so all invocations of "+", "-", "/", "*" should be replaced by macros that invoke the corresponding functions in the software implementation.

Has anybody done something like this with openlibm? Or maybe are there any future plans for supporting FP software implementations?

cesss commented 2 years ago

I'm closing this issue because I've started to write such library myself.