How do I detect if something is equal to NaN?

I thought is was a simple solution, but it didn't end up working.
I was trying to find out why it didn't work, but I found something else weird:

<((0) / (0)) = ((0) / (0))> //false
script variables ((a) :: grey) ((b) :: grey) :: grey
set [a v] to ((0) / (0))
set [b v] to ((0) / (0))
report <(a) = (b)> :: control cap //true

Yep - the OP found that my initial solution behaved differently when a variable is involved

Oh, that is strange! It didn't surprise me that a=a reported true, and it wouldn't surprise me if SET B TO A made a=b true, but two different 0/0 results shouldn't be equal, you're right.

I think this is even more weird


usually the identical to block is better for detecting exact replicas, but...

Yup, okay, when the conference is over I'll look into this...

I looked into it a bit, and I found out that...


apparently when you try to store a NaN value in a variable, it turns into 0

That explains everything.

I'm now thinking that to detect if something is NaN, you can use lambda,



and in order to do this is a custom block, you use an unevaluated input

How do you do it without using an unevaluated input?

You can't really.

yeah, I meant lambda

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.