Hello,

PJS (Parrot JavaScript) allows a number to be NaN. The result of
comparing an NaN to any value is false (thus all of NaN == NaN, NaN <
NaN, NaN > NaN, NaN <= NaN, NaN >= NaN evaluate to false).

There is only the vtable function C<cmp> that a PMC can implement to
define ordering.
Parrot assumes that for any PMC that wants ordering, each two values
of that PMC are ==, < or >, which is not the case for NaNs.

Would it not be better if there were different vtable functions for <,
<=, > and >= (which can call the C<cmp> vtable function as default)?

And here is another issue I encountered with my workaround for my
previous problem. Ok, Parrot does not want me to generate an NaN by
doing 0.0/0.0, but that does not prevent me from storing NaNs in them
(which come from PjsNumber PMCs). But when $N0 is NaN, comparing $N0
<= $N0 gives inconsistent results. For the default runcore, it
evaluates to 0 (which is the expected result), but for the jitted
core, it evaluates to 1.

Is is my fault to store NaNs in N registers, or can I assume that this
is a JIT bug?

Thanks in advance.


Mehmet Soyturk

Reply via email to