[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tostring vs. nan, inf
- From: Elias Barrionovo <elias.tandel@...>
- Date: Thu, 12 Apr 2012 13:17:33 -0300
On Thu, Apr 12, 2012 at 12:31 PM, Coda Highland <chighland@gmail.com> wrote:
> On Thu, Apr 12, 2012 at 10:26 AM, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
>> But I notice nan cannot be assigned to a variable, the variable is set to nil.
>
> That's because nan isn't a constant. It's just a variable that happens
> to be undefined. If you say "nan = 0/0" then it'll behave as you'd
> expect.
Indeed. A cool trolling exercise is to do
nan = 1/0
inf = 0/0
print(nan, inf) -- "inf, -nan" (for some reason, in my computer 0/0
is always -nan)
Reminds me of Python where, since all values are passed as reference, on can do
True, False = False, True
on the middle of a huge source and laugh while every developer
desperately tries to track the bug.
--
NI!
- References:
- tostring vs. nan, inf, Alexander Gladysh
- Re: tostring vs. nan, inf, Luiz Henrique de Figueiredo
- Re: tostring vs. nan, inf, Alexander Gladysh
- Re: tostring vs. nan, inf, Martin Guy
- Re: tostring vs. nan, inf, Luiz Henrique de Figueiredo
- Re: tostring vs. nan, inf, Jose Torre-Bueno
- Re: tostring vs. nan, inf, Coda Highland