JuliaData / JuliaData/SentinelArrays.jl

Equality to Float64 NaN failing

Open
#104 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
22
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to src/SentinelArrays.jl lines 184-185; start by reproducing the two NaN examples with Julia 1.10.5 and SentinelArrays v1.4.5. Inspect the sentinel comparison there and verify that both NaN values behave consistently when used as the sentinel, including the displayed array results.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.