isequal converts ("promotes") both arguments to a common type, if they have different types. Thus NaN16 and NaN32 are converted to NaN (i.e. NaN64), hence isequal returns true. See `isequal(5, 5.0)`.
The two equality notions in Julia do nest: `isequal` and `is`, where the latter is more strict than the former. The operator `==` is basically identical to `isequal`, except it also handles IEEE semantics, which technically isn't a valid notion of equality, and thus it cannot nest. -erik On Fri, Dec 18, 2015 at 8:09 AM, Tamas Papp <tkp...@gmail.com> wrote: > For example, > > julia> isequal(NaN,NaN16) > true > > julia> isequal(NaN,NaN32) > true > > This is of course documented in the manual, what I would like to > understand is the motivation for this design decision. Some languages > have a progression of equality predicates --- eg Common Lisp has EQ, > EQL, EQUAL, and EQUALP, each more permissive than the next one. But == > and isequal do not nest, since NaN's are of course not == to anything > under IEEE, even themselves. > > Before reading about this in the manual, I thought of isequal as object > identity ("A and B are equal when they cannot be distinguished"), but > apparently that's the wrong concept. > > Just curious -- there must be a good reason and I would like to know it. > > Best, > > Tamas > -- Erik Schnetter <schnet...@gmail.com> http://www.perimeterinstitute.ca/personal/eschnetter/