Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`min` does not return the minimum with respect to `isless` when values tie

Aperta
#868 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@devmotion ci sta già lavorando.

Dal 26/10/2026.

  • #869 di @devmotion — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
julia
Ambito
backend

Direzione di ricerca

Start by reading the min implementation and its tests, then compare its tie handling with isless as changed in #695. Reproduce the reported min(x, 48.0) and min(48.0, x) results with ForwardDiff.Dual; done means tied values are selected consistently with isless, independent of argument order, and the regression is covered by a test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

min is documented to "return the minimum of the arguments, with respect to isless", but for a Dual that ties in value it returns whichever argument comes first:

julia> using ForwardDiff

julia> x = ForwardDiff.Dual(48.0, 1.0);

julia> isless(48.0, x)
true

julia> min(x, 48.0)
Dual{Nothing}(48.0,1.0)

julia> min(48.0, x)
Dual{Nothing}(48.0,0.0)

Since #695, isless breaks a value tie on the partials, so 48.0 is the smaller argument here, but min(x, 48.0) returns x. min picks its argument by value only, so on a tie the result depends on argument order rather than on isless.

I ran into this through differentiating Interpolations.jl, whose linear extrapolation clamps with min and then bounds-checks the result with <=, so it throws a BoundsError under --check-bounds=yes when differentiating exactly at the last knot.

ForwardDiff 1.4.6, Julia 1.12.7.

Lingua principale
Julia
Stelle
1k
Fork
165
Merge medio
6h 34m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JuliaDiff/ForwardDiff.jl

Tutte le issue di JuliaDiff/ForwardDiff.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.