Skip to content

Define < and isless for Partials - #791

Merged
devmotion merged 1 commit into
masterfrom
dmw/partials_cmp
Dec 28, 2025
Merged

Define < and isless for Partials#791
devmotion merged 1 commit into
masterfrom
dmw/partials_cmp

Conversation

@devmotion

Copy link
Copy Markdown
Member

Fixes the incorrect comparison in #790 involving NaN. With this PR:

julia> xs =Dual(0.0,NaN)
Dual{Nothing}(0.0,NaN)
julia> xs <0false
julia> xs >0false
julia>isless(xs, 0)
false
julia>isless(0, xs)
true

@andreasnoackandreasnoack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a bit of a treasure hunt to find out why this was necessary. Hadn't realized that

julia> [0.0] < [NaN]
true
julia> (0.0,) < (NaN,)
false

It reminds me of an objection I had against the definitions in operators.jl a long time ago. I don't understand how it is sound to define any fallbacks for Any.

@devmotion
devmotion merged commit e1eb522 into masterDec 28, 2025
53 of 76 checks passed
@devmotion
devmotion deleted the dmw/partials_cmp branch December 28, 2025 20:14
Sign up for freeto 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.

2 participants

@devmotion@andreasnoack