Closed postmath closed 1 year ago
Looks good. If you prefer a different name for this function, I don't mind changing it.
arf_get_mag
rounds inexactly for speed reasons. It would indeed be better to make it round exactly, so that cases like this work as expected, having an arf_get_mag_sloppy
for the cases where saving the 1-2 cycles matters.
No need for the other name, I changed my mind and I like this version now :)
On Fri, Nov 11, 2022, 16:33 Fredrik Johansson @.***> wrote:
Looks good. If you prefer a different name for this function, I don't mind changing it.
arf_get_mag rounds inexactly for speed reasons. It would indeed be better to make it round exactly, so that cases like this work as expected, having an arf_get_mag_sloppy for the cases where saving the 1-2 cycles matters.
— Reply to this email directly, view it on GitHub https://github.com/fredrik-johansson/arb/pull/443#issuecomment-1312208117, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDYH3WOT3FCQYKJXSLC6C3WH23TPANCNFSM6AAAAAAR5VFV2Y . You are receiving this because you authored the thread.Message ID: @.***>
Note the following behaviour. Taking the "nonnegative abs" of
[0 \pm 1]
:you don't get the exact interval
[0.5 \pm 0.5]
, but instead the centre and radius are one ulp (of amag_t
) greater than that. That ulp is introduced inarf_get_mag
. I'm not sure there is an obvious workaround for that. (The example I ran into started with[0 \pm 0.25]
, but I think[0 \pm 1]
should work the same.)Note furthermore that the "whole real line" object can be returned by this function, which still contains negative numbers. So the result does not always satisfy
arb_is_nonnegative
. Neither does NaN, of course. I think those are the only two cases.