mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
fix
This commit is contained in:
parent
f5d37425f5
commit
08a8513462
2 changed files with 26 additions and 1 deletions
|
@ -55,7 +55,7 @@ _arb_poly_newton_step(arb_t xnew, arb_srcptr poly, long len,
|
|||
arb_add_error_arf(u, err);
|
||||
|
||||
if (arb_contains(convergence_interval, u) &&
|
||||
(arf_cmpabs_mag(arb_radref(u), arb_radref(x)) < 0))
|
||||
(mag_cmp(arb_radref(u), arb_radref(x)) < 0))
|
||||
{
|
||||
arb_swap(xnew, u);
|
||||
result = 1;
|
||||
|
|
25
mag.h
25
mag.h
|
@ -548,6 +548,31 @@ mag_get_fmpq(fmpq_t y, const mag_t x)
|
|||
fmpr_clear(t);
|
||||
}
|
||||
|
||||
/* TODO: document/test */
|
||||
static __inline__ int
|
||||
mag_cmp(const mag_t x, const mag_t y)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (mag_equal(x, y))
|
||||
return 0;
|
||||
|
||||
if (mag_is_special(x) || mag_is_special(y))
|
||||
{
|
||||
if (mag_is_zero(x)) return -1;
|
||||
if (mag_is_zero(y)) return 1;
|
||||
if (mag_is_inf(x)) return 1;
|
||||
if (mag_is_inf(y)) return -1;
|
||||
}
|
||||
|
||||
c = fmpz_cmp(MAG_EXPREF(x), MAG_EXPREF(y));
|
||||
|
||||
if (c == 0)
|
||||
return (MAG_MAN(x) < MAG_MAN(y)) ? -1 : 1;
|
||||
|
||||
return (c < 0) ? -1 : 1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue