RE: Uninitialized Variables

new topic     » goto parent     » topic index » view thread      » older message » newer message

> 
> This seems to work:
> --------------
> atom x,nan,inf
> inf = 1e300 * 1e300
> nan = inf / inf
> 
> x = nan
> 
> if x = nan then
>     puts(1, "x is not a number\n")
> end if
> ? x = nan
> ? x != nan
> 

Actually, it doesn't.  Because

(10 = nan)
(2.3 = nan)

will also evaluate as true and

(10 != nan)

will evaluate as false.

You need to be able to tell a non-nan from a nan...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu