JuliaMath / JuliaMath/FixedPointNumbers.jl
Overflow checked arithmetics
- Lingua principale
- Julia
- Stelle
- 95
- Fork
- 38
- Merge medio
- 13m
- PR unite (30g)
- 2
Descrizione
As discussed in [https://github.com/JuliaLang/julia/issues/15690](url) with @timholy I've been recently bitten by the inconsistency regarding overflow in FixedPoint arithmetic when dealing with Images.jl.
FixedPointNumbers are pretending to be `<:Real` numbers, but their behavior regarding arithmetic is more like `Integer`. I just cannot think of any use-case one would get any advantage from the "modulo" arithmetic when dealing with the numbers guaranteed to fall within <0, 1> range. I'd be glad if my code stopped by an OverflowError exception indicating problem in my algorithm. Thus, easy fixable by manual widening of the operands. With the current silent overflow, algorithm just continues, giving finally wrong results.
Before writing a PR to introduce arithmetic that throws on overflow or underflow, I'd like to know your opinion on this change. I was also thinking of using a global "flag" to dynamically opt-in for the overflow-checking behavior but i'm worried about the branching costs. Is it possible e.g. use traits for this behavior change?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo l’issue #15690 di JuliaLang indicata e gli attuali punti di ingresso dell’aritmetica FixedPoint. L’issue richiede di decidere un approccio per il comportamento in caso di overflow e underflow, compreso se siano appropriati un comportamento opt-in o i Traits; il lavoro è completato quando esiste una modifica concordata e specificata, anziché una discussione di progettazione irrisolta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia
- Ambito
- backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100