[erlang-questions] Strange behaviour of =:= applied to int and int64

Dmitry Groshev lambdadmitry@REDACTED
Wed Sep 7 15:42:19 CEST 2011


I'm using R14B03 and writing a little NIF library. Today I've
encountered a strange behaviour of =:= when it is used against number
that is set in sources and term that was constructed as
enif_make_unit64. Here is an example:

(circa_dev@REDACTED)1> {ok, T} = ecirca:new(5, last, small).
{ok,{ecirca,#Ref<0.0.0.57>,<<>>,<0.48.0>,small}}
(circa_dev@REDACTED)2> {ok, A} = ecirca:size(T).
{ok,5}
(circa_dev@REDACTED)3> B = 5.
5
(circa_dev@REDACTED)4> A == B.
true
(circa_dev@REDACTED)5> A =:= B.
false
(circa_dev@REDACTED)6> A.
5
(circa_dev@REDACTED)7> B.
5

This behaviour looks quite weird to me. Is it expected?



More information about the erlang-questions mailing list