Skip to content

Equality to Float64 NaN failing #104

@jaakkor2

Description

@jaakkor2

Here equality of NaN_1 to NaN fails

using SentinelArrays

NaN_1 = reinterpret(Float64, 0xffffd10000000000)
NaN_2 = reinterpret(Float64, 0x7ff8000000000000)
SentinelArray([NaN_1, 1.1], NaN, missing) # [NaN, 1.1]
SentinelArray([NaN_2, 2.2], NaN, missing) # [missing, 2.2]

Guessing: here https://github.com/JuliaData/SentinelArrays.jl/blob/v1.4.5/src/SentinelArrays.jl#L184-L185 defines to use === as comparison. Docstring for NaN says

Always use isnan or isequal for checking for NaN. Using x === NaN may give unexpected results

Julia 1.10.5, SentinelArrays v1.4.5

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