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

Inadequate support of `promote_rule` for non-concrete types

Aperta
#343 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
julia
Ambito
backend

Direzione di ricerca

Reproduce the listed promote_rule cases in the Julia REPL and read the handling in ColorTypes.jl. Compare the behavior with issue #342, then establish expected results for the examples, including avoiding StackOverflowError. Done means the non-concrete promotion cases behave consistently without the reported errors.

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

Descrizione

bug

For better or worse, PR #207 is the most significant change in FPN v0.9.
However the current promote_rule for non-concrete types is somewhat imperfect.
In ColorTypes.jl, I am keenly aware that the handling of non-concrete types can lead to chaos.
Here, I’d like to think about ways to make things a little better, as long as they don’t go against common sense.

julia> promote_rule(Normed{UInt8, 8}, Fixed{Int8, 7})
Float32

julia> promote_rule(Normed{UInt8}, Fixed{Int8})
Union{} # -> Float32

julia> promote_rule(Normed{UInt8}, Normed{UInt8})
Union{} # -> Normed{UInt8}

julia> promote_rule(Normed{UInt8}, Normed{UInt16})
Union{} # -> Normed{UInt16}

julia> promote_rule(Normed{UInt8}, Normed)
Union{} # -> Normed

julia> promote_rule(Normed{UInt8}, Normed{Union{UInt8, UInt16}})
Union{} # -> Normed (Any desire to make this more strict is a path to despair.)

julia> promote_rule(Normed{UInt8}, FixedPoint)
Union{} # -> FixedPoint

julia> promote_rule(Normed{UInt8}, Float64)
Float64

julia> promote_rule(Normed, Float64)
ERROR: StackOverflowError # -> BigFloat

julia> promote_rule(Normed{UInt8}, Int8)
Float32

julia> promote_rule(Normed, Int8)
Normed # -> BigFloat

Some of the unnatural promotions or stack overflow errors are caused by issue #342. In other words, fixing issue #342 will resolve some of these issues.

Lingua principale
Julia
Stelle
95
Fork
38
Merge medio
16h 31m
PR unite (30g)
9

Preparare l'ambiente

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 JuliaMath/FixedPointNumbers.jl

Tutte le issue di JuliaMath/FixedPointNumbers.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.