Skip to content

Reject NaN values and bounds in Range - #453

Open
Aschenbath wants to merge 1 commit into
go-ini:mainfrom
Aschenbath:fix/oss20more-bc63-ini-range-nan
Open

Aschenbath wants to merge 1 commit into
go-ini:mainfrom
Aschenbath:fix/oss20more-bc63-ini-range-nan

Conversation

@Aschenbath

Copy link
Copy Markdown

Describe the pull request

With rate = NaN, Range(key, 0.5, 0, 1) returns NaN instead of the default. The current negated < checks both succeed because NaN is unordered. A NaN bound also lets otherwise unconstrained values through.

Require each inclusive bound using positive comparisons. Tests cover NaN values and bounds for float32, float64 and a named float type, plus finite endpoints, out-of-range values and infinite endpoints.

Link to the issue: n/a

Validation: the new NaN regression fails on main and passes with this change. go test -count=1 ./..., go vet ./..., gofmt, and git diff --check pass on Go 1.26.11, Windows/amd64.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code.

AI usage

OpenAI Codex assisted with investigation, implementation, regression tests, validation, and review of the final diff.

@Aschenbath
Aschenbath requested a review from unknwon as a code owner November 24, 2026 16:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant