Special float values
jerry gay
jerry.gay at gmail.com
Wed Nov 26 15:55:58 UTC 2008
On Wed, Nov 26, 2008 at 07:46, Will Coleda <will at coleda.com> wrote:
> On Wed, Nov 26, 2008 at 10:42 AM, François Perrad
> <francois.perrad at gadz.org> wrote:
>>
>> in languages/lua/src/lib/mathx.pir, I want create numbers with special
>> value (NaN & Infinity), something like :
>>
>> new $P0, 'Float' # or 'LuaNumber'
>> set $N0, 'NaN'
>> set $P0, $N0
>> say $P0
>>
>> Is it possible ?
>>
>> François.
>
> I don't know about inf, but yes, nan works:
>
> .sub main
> $N0 = 'nan'
> if $N0 != $N0 goto ok1
> print 'not '
> ok1:
> say 'ok 1'
>
> $P0 = new 'Float'
> $P0 = $N0
> if $P0 != $P0 goto ok2
> print 'not '
> ok2:
> say 'ok 2'
>
> .end
>
i have a feeling that's os-dependent. msvc produces:
not ok 1
not ok 2
~jerry
More information about the parrot-dev
mailing list