Issue with Math::AnyNum workaround for mpc-1.4.0 ui/fr division bug.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start in AnyNum.pm around line 2536 and inspect the workaround for Math::MPC division, then review the related mpc_ui/fr_div calls in MPC.xs. Compare behavior with mpc-1.4.0 and earlier versions, including an imaginary component of -0. Done means the workaround preserves the intended signed-zero result without breaking compatibility with older MPC versions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I see that in AnyNum.pm, at around line 2536, you have replaced:
Math::MPC::Rmpc_ui_div($r, 1, $x, $ROUND);
with:
Math::MPC::Rmpc_set_ui($r, 1, $ROUND);
Math::MPC::Rmpc_div($r, $r, $x, $ROUND);
For (and only for) the case that the imaginary component of $x is 0:
If building against mpc-1.3.x or earlier, both Math::MPC::Rmpc_ui_div($r, 1, $x, $ROUND) and its replacement code set the imaginary part of $r, to 0.
However, beginning with mpc-1.4.0, a correction has been made that has the "Rmpc_ui_div" form set that imaginary part to -0, whilst leaving the behaviour of that "replacement code" unchanged.
The same would apply to a similar workaround with Rmpc_fr_div.
(This, of course, was the change that introduced the bug you discovered.)
IOW, when built against mpc-1.4.0, your replacement code will set the imaginary part to 0, though it should set that part to -0 (given that it's intended to replace "Rmpc_ui_div").
It's actually ok with me if you don't want to do anything about this. The values being returned are essentially correct - the only discrepancy is the sign of zero.
And, as it stands, it is consistent with the (incorrect) behaviour of Rmpc_ui/fr_div in the mpc-1.3.x library (and earlier).
Feel free to close this ticket if you're not fussed about it.
AFAIK, Math-MPC-1.42 works efficiently around the division bug.
The macros that do the fixing are defined only if the mpc version is 1.4.0. For all other versions, Rmpc_fr_div and Rmpc_ui_div are unchanged. I've also applied the same fix for mpc_ui/fr_div calls that are made elsewhere in MPC.xs.
However, Math-MPC-1.42 doesn't fix that incorrectness of Rmpc_/ui/fr_div when built against mpc-1.3.x or earlier.
That shouldn't be hard to address - I'll do that in Math-MPC-1.43. (I wish I had thought of doing that before I released 1.42.)
Reminder to self: Need to also handle the case where the imaginary part of $x is -0.
- Lingua principale
- Perl
- Stelle
- 0
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di trizen/Math-AnyNum
-
gaussianAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
trizen/Math-AnyNum#2 · 2 commenti ·
Tutte le issue di trizen/Math-AnyNum
Issue simili
-
Add .gitattributes so share/skel keeps LF on a Windows git checkoutForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
PerlDancer/Dancer2#1854 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
major/MySQLTuner-perl#1007 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
bioconda/bioconda-recipes#70187 ·
I maintainer di solito rispondono entro 2 giorni