IEEE 754 floating point, POSIX, C: Why are OpenBSD's logb and logbf wrong?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IEEE 754 floating point, POSIX, C: Why are OpenBSD's logb and logbf wrong?

Neven Sajko
Hello,

I am discussing the OpenBSD logb and logbf from the mathematical part
of the C standard library, the same which were imported from NetBSD.

They currently return constants for subnormal inputs. As far as I
understand, this is not only not very useful for doing math, it also
conflicts with POSIX/SUS and the C standard and the established
practice of what other libraries are doing: FreeBSD libm, openlibm,
Go(lang) math library, I think even OpenBSD's ilogb all do the right
thing.

If a fix is wanted, I think OpenBSD's licensing requirements permit
simply taking the code from FreeBSD or openlibm (all of those have
shared ancestors, so merging should be quite easy).

On the other hand, the man page for logb (also left over from NetBSD)
says "These functions allow users to test conformance to IEEE Std
754-1985. Their use is not otherwise recommended.", so it could be
that logb(f) are wrong on purpose?

Regards,
Neven Sajko

Reply | Threaded
Open this post in threaded view
|

Re: IEEE 754 floating point, POSIX, C: Why are OpenBSD's logb and logbf wrong?

Neven Sajko
Continuing on the bugs list, so respond there if appropriate.

Regards,
Neven Sajko