[erlang-questions] Inf, NaN, and -Inf

Sverker Eriksson <>
Tue Feb 28 17:40:13 CET 2012


Peer Stritzinger wrote:
> Is the runtime somehow built around assumptions that Inf and NaN never
> occur as values?
>
>   
Yes.
Inf and NaN are not valid terms and does instead result in badarith 
exceptions.


 > Could a NIF be build to grandfather the forbidden values in?

That is not supported, and will probably lead to badarith exceptions or 
maybe even other strange behavior depending on what you do with the 
forbidden terms.

To introduce inf and -inf as valid terms, one would have to deal with 
the problem of backward compatibility.

/Sverker, Erlang/OTP Ericsson





More information about the erlang-questions mailing list