On Mon, Dec 7, 2015 at 7:01 PM, Davide Lasagna <[email protected]> wrote:
> Cool! Thanks

Also note that since your type is mutable, the default `==` is object
identity and your `a` and `b` won't equal even if their content are
the same by default. An `immutable` type will compare the content by
default (although `-0.0` and `0.0` have different bit pattern and
won't equal as a field by default as you pointed out).

```
julia> type foo
           a::Float64
       end

julia> b = foo(0)
foo(0.0)

julia> a = foo(0)
foo(0.0)

julia> a == b
false

julia> immutable bar
           a::Float64
       end

julia> b = bar(0)
bar(0.0)

julia> a = bar(0)
bar(0.0)

julia> a == b
true

julia> bar(0.0) == bar(-0.0)
false
```

Reply via email to