Nathaniel Shaffer

Results 15 comments of Nathaniel Shaffer

I agree with @everythingfunctional on this issue. There's a ton of up-front labor in implementing fully polymorphic containers, and I'm not convinced that they're that much more useful than having...

Some more worth considering: * Functions to evaluate `z*log(z)` and `log(z)/z` which give the correct behavior near `z=0`. Not sure of good names. Some with a distinctly statistical flavor, which...

Yeah, NSWC has a lot of nice functionality, as long as you don't need complex numbers. But their implementations may still be useful reference material, especially for things like error...

In my own codes, Fortran's `contains` mechanism usually makes this a non-issue. As a sketch, consider a 1-D Newton-like rootfinder with the interface function root(f, df, x0, ...) interface real...

How about an optional argument to decide which branch you want? `f = cbrt(z)` always has `0

As for negative real arguments, I am inclined to have `cbrt(-x) == -cbrt(x)` (for positive `x`). Upshot: this is what we learn in school before getting introduced to complex numbers....

Or better yet, cast it to complex first. I have in mind: `cbrt(-8.) == -2.` `cbrt(cmplx(-8.)) == (1., sqrt(3.))` `cbrt(cmplx(-8.), k=1) == (-2., 0.)`

As for implementation, it seems good enough to pass `abs(x)` to the C math.h `cbrt`/`cbrtf`/`cbrtl` function, and then multiply by the appropriate sign or phase factor, using `ieee_copy_sign` if we...

First, let me clarify that I suggested `-huge(x)` as a return value for a specific edge case for `mean` in order to *avoid* returning NaN. So we need not consider...

Assuming we want to be able to produce NaNs of various kinds, I suggest the following API ```fortran pure elemental function nan_(x) real(), intent(in) :: x real() :: nan_ end...