boostorg/math

<ccmath.hpp> frexp fractional path?

Opened this issue · 3 comments

Hi Matt (@mborland)

I've recently used your fascinating work in <ccmath.hpp> as both a reference and inspiration for doing compile-time math in other Boost work.

I find that the fractional path (i.e., for arg < 0.5) seems like it might be curiously missing from the constexpr-version of frexp(), as indicated here.

A second trivial questoin is if the pointer needs a nullptr check in the zero-path here?

I'm playing around with a similar impl for Multiprecision here.

I can't use you Math impl out of the box for a few reasons like standalone and use of <cmath>funcs.

But another issus arises. When using Real template param to be float, the numer $2^{32}$ has too many digits for lots of float implementations. Ultimately, I'd use a ternary choice for $2^{16}$ or $2^{48}$ and related constants depending on the numeric_limits<Real>::digits value.

You are correct that we should be checking for nullptr dereference to avoid UB.

I'll take a look at your implementation and adjust accordingly.

look at your implementation...

Thanks Matt (@mborland)

Did I miss something for $|arg|&lt;0.5$ in the implementation? What about fractional argument resulting in negative expval? Maybe I missed something simple somewhere obvious.