Just some blocks! (Part 2)

Continuing the discussion from Just some blocks! (Part 1) - #256 by redgeographysnap.

Previous discussions:

Sorry, I thought SNAP! coerced NaN into the string “NaN”

untitled script pic - 2026-02-17T145917.749

Just as the character string “123” isn’t the internal representation of the number one hundred twenty-three, the string “NaN” isn’t the internal representation of a floating point NaN.

Oh, right. I remember reading about that in the FAQ about decimal to binary.

It’s just that (for me), if

Untitled script pic - 2026-02-17T174630.233

is true, then

Untitled script pic - 2026-02-17T174752.983

should also be true (although it isn’t)

You make a good argument, except that the floating point standard specifies that NaN is never equal to anything, not even itself. :~/

Right, I remember that from JavaScript!

Although this would start to get confusing if
Untitled script pic - 2026-02-17T181256.932
returned false. Maybe we need an isNaN operator?

and maybe also NaN support for variables

What do you mean by that? Any value can be the value of a variable, so why do variables need special support for NaN?

Because NaN is not equal to NaN, you can check whether something is NaN by checking if it isn’t equal to itself.

You can’t actually set a variable to (the floating point) NaN.
untitled script pic - 2026-02-18T081504.793

Oh. That’s a bug; I made a github issue for it.

new blocks

I get that, but then

untitled script pic (98)

Which could get confusing. In SNAP!, strings that look like numbers are treated like numbers!

New block’s (mostly just for the pen)!

btw here’s the link if you haven’t just some blocks by cybercube | Snap! Build Your Own Blocks

??? Why’d you tag me?

sorry :pensive_face:

new blocks

No it’s fine. I’m just asking :)