RFD: Adding an op that checks for Inf, -Inf, NaN

Nick Wellnhofer wellnhofer at aevum.de
Tue Dec 6 17:53:39 UTC 2011


On 06/12/2011 11:09, Moritz Lenz wrote:
> Hi all,
>
> for some operations in Rakudo it is important for us to check if a num
> value is one of Inf/-Inf/NaN.

Something like the following should work without new ops:

isNaN(d) { return d != d; }
isInf(d) { return d > DBL_MAX; }
isNegativeInf(d) { return d < -DBL_MAX; }

Nick


More information about the parrot-dev mailing list