Open
Description
I propose that we provide a module with miscellaneous mathematical functions, those which feel like they could/should be intrinsics, but are not for whatever reason. From my own experience, here are functions which I have felt the need to implement myself several times:
expm1(x)
andlog1p(x)
- I suspect that many compilers detectexp(x) - 1.0
/log(1.0 + x)
and call appropriate library routines, but I'd like to provide these explicitly.signum(x)
- The intrinsicsign
function is awkward to use when you just want to know the sign of a number.cbrt(x)
- Again, I suspect many compilers detectx**(1.0/3.0)
and call into their math library'scbrt
. However, real exponents are ugly and error-prone and would like a more semantic replacement for this common case.sinc(x)
- I am tired of writing my own implementation of this, and I suspect others are as well, even if it is trivial.phase(z)
- Equivalent toatan2(z%im, z%re)
Let's brainstorm further functionality that you'd like to see.