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

Moritz Lenz moritz at faui2k3.org
Wed Dec 7 10:23:24 UTC 2011


Am 06.12.2011 18:22, schrieb Jonathan "Duke" Leto:
> I am +1 to adding this op, with tests. I can help with the tests if needed.

Please take a look at t/op/inf_nan.t function test_is_inf_or_nan. It's 
not very comprehensive, but there are really just 4 cases to consider, 
afaict (Inf/-Inf/NaN/normal)

> I would very much like to see some benchmark data of Rakudo with and without
> this opcode to see what kind of performance change this entails.

I don't have a benchmark here, but considering that the alternative to 
that op is something like   (Inf|-Inf|NaN).ACCEPTS($value)  which 
involves calls to at least 6 other routines, and thus 12 additional 
GC-ables, I'm quite sure it is easily measurable. And all that for a 
call to floor($num) or ceiling($num).

Cheers,
Moritz


More information about the parrot-dev mailing list