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

Jonathan "Duke" Leto jonathan at leto.net
Tue Dec 6 19:37:18 UTC 2011


Howdy,

Note that the example functions below would return false for
IsInf(-Inf) which may not be
expected.

Duke

On Tue, Dec 6, 2011 at 9:53 AM, Nick Wellnhofer <wellnhofer at aevum.de> wrote:
> 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
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev



-- 
Jonathan "Duke" Leto <jonathan at leto.net>
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.


More information about the parrot-dev mailing list