0 is not equal 0?

I have this weird case where I am calculating cosine of a bunch of numbers, one of which is 0.5 * pi (ie. 180 degrees), which should be equal to 0 and that’s what it says. But when I check the number if it is equal to 0 I get false (see first line in the panels)

What am I missing?

not_zero.gh (6.0 KB)

1 Like

Panels aren’t reliable for seeing the complete float.

Oh. So cosine doesn’t calculate to proper 0. Then why display values at “0.5 * pi”, but then not actually use pi properly!?

Guess I’ll have to round to some significant numbers.


isEqual.gh (4.3 KB)


Welcome to the world of floating point arithmetic