Add is_inf and is_nan functions to builtin::
As it is not expected that these two functions are likely to be called very often, I didn't bother making inlined-opcode variants of them as per e.g. is_bool(). Instead these are just regular XSUBs like trim() is.
Testing-wise, I'm a little unsure about the use of 1 * (inf - inf) to get a calculated NaN value, but I really couldn't think of anything else that actually works. Is it portable enough?
Another issue with this (and ceil(), floor() for that matter), is it doesn't support overloads in the same way other numeric functions do, e.g.:
use overload sin => sub { ... };
It's less of an issue if the 0+ overload returns a Inf/Nan as needed (which this code also doesn't support), but I can see it as an issue for ceil/floor with bignum-ish overloads.
Another issue with this (and ceil(), floor() for that matter), is it doesn't support overloads in the same way other numeric functions do, e.g.:
use overload sin => sub { ... };It's less of an issue if the
0+overload returns a Inf/Nan as needed (which this code also doesn't support), but I can see it as an issue for ceil/floor with bignum-ish overloads.
@leonerd, @tonycoz has noted some significant problems with this pull request. Do you wish to pursue it further? Thanks.