Skip to content

Comparison between -0.0 and 0.0 is incorrect #221

@timholy

Description

@timholy
julia> x = Double64(-0.0)
-0.0

julia> y = zero(x)
0.0

julia> x <= y
false

This stems from using === instead of == here:

@inline function (<=)(x::DoubleFloat{T}, y::DoubleFloat{T}) where {T<:IEEEFloat}
return (HI(x) < HI(y)) || (HI(x) === HI(y) && LO(x) <= LO(y))
end

However, I'm not familiar enough with the delicate issues this package must deal with to feel confident that merely changing it to == is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions