Bug in arb_div

23 views
Skip to first unread message

Jean Kieffer

unread,
May 22, 2025, 11:48:39 AMMay 22
to flint...@googlegroups.com
Hi,

I believe I found a bug in arb_div, causing it to return NaN when
dividing x/y where x = 0 +- something at high precision, for any y. (In
my case x was 0 on the nose.)

In src/arb/div.c, line 105, in arb_div_newton, the condition
arf_is_special(arb_midref(x)) will hold true when arb_midref(x) = 0,
triggering a NaN result. A probable fix would be to write

if (!arf_is_finite(arb_midref(x)) || arf_is_special(arb_midref(y)))

or possibly to edit the WANT_NEWTON macro.

Best,
Jean

--
Jean Kieffer
CNRS researcher at Loria (Nancy, France), CARAMBA team
https://members.loria.fr/JKieffer/

Jean Kieffer

unread,
May 22, 2025, 11:48:39 AMMay 22
to flint...@googlegroups.com
Hi again,

Well it turns out this precise fix doesn't work (it leads to "error: ulp
error not defined for special value", at least for x=0), so I'm not sure
what the correct one would be !

Best,
Jean

Jeffrey Sarnoff

unread,
May 22, 2025, 11:52:30 AMMay 22
to flint...@googlegroups.com
Would it make sense to define ulp(0) based on the working precision?

--

---
You received this message because you are subscribed to the Google Groups "flint-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flint-devel...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/flint-devel/873a83df-d216-4661-90e9-5ac54dc43d43%40gmail.com.

Fredrik Johansson

unread,
May 22, 2025, 6:05:10 PMMay 22
to flint...@googlegroups.com
Hi Jean,

Thanks for the bug report. arb_div was missing an early branch to deal specially with x = 0 or 0 +/- eps; it should not be entering the Newton code here.


Fredrik

--

---
You received this message because you are subscribed to the Google Groups "flint-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flint-devel...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages