LoginLogin

Infinity and Not a Number

Root / Programming Questions / [.]

AveryCreated:
I don't know how infinity (∞) and non-numbers (NaN) are "made" in SmileBASIC. I thought dividing by zero would've made "NaN", but I just got a stopping error.

The easiest way I've found is to use POW to make infinity, like POW(10,309). And you can multiply that by 0 to get NaN. But I don't think there are any built-in constants for these values or anything.

There's a character for infinity though, which is weird. Also, why would you want infinity and NaN as values? What use do you have for them?

There's a character for infinity though, which is weird. Also, why would you want infinity and NaN as values? What use do you have for them?
I may use them for special meanings in numerical arrays. For example, if I want to take an item "out" of an array, I could replace it with NaN to signify that that is an item to skip. I don't know. I mostly just wanted to test CLASSIFY().