mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
add rel_one_accuracy_bits methods; improvement to precision handling for hypgeom_m
This commit is contained in:
parent
a924e77041
commit
b17506e22d
7 changed files with 52 additions and 3 deletions
2
acb.h
2
acb.h
|
@ -1012,6 +1012,8 @@ acb_rel_accuracy_bits(const acb_t x)
|
|||
return -acb_rel_error_bits(x);
|
||||
}
|
||||
|
||||
slong acb_rel_one_accuracy_bits(const acb_t x);
|
||||
|
||||
ACB_INLINE slong
|
||||
acb_bits(const acb_t x)
|
||||
{
|
||||
|
|
|
@ -64,3 +64,22 @@ acb_rel_error_bits(const acb_t x)
|
|||
return result;
|
||||
}
|
||||
|
||||
slong acb_rel_one_accuracy_bits(const acb_t z)
|
||||
{
|
||||
if (arf_cmpabs_2exp_si(arb_midref(acb_realref(z)), -1) < 0 &&
|
||||
arf_cmpabs_2exp_si(arb_midref(acb_imagref(z)), -1) < 0)
|
||||
{
|
||||
acb_t t;
|
||||
arf_init(arb_midref(acb_realref(t)));
|
||||
arf_one(arb_midref(acb_realref(t)));
|
||||
arf_init(arb_midref(acb_imagref(t)));
|
||||
*arb_radref(acb_realref(t)) = *arb_radref(acb_realref(z));
|
||||
*arb_radref(acb_imagref(t)) = *arb_radref(acb_imagref(z));
|
||||
return acb_rel_accuracy_bits(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
return acb_rel_accuracy_bits(z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,10 +228,10 @@ acb_hypgeom_m_choose(int * asymp, int * kummer, slong * wp,
|
|||
return;
|
||||
}
|
||||
|
||||
input_accuracy = acb_rel_accuracy_bits(z);
|
||||
t = acb_rel_accuracy_bits(a);
|
||||
input_accuracy = acb_rel_one_accuracy_bits(z);
|
||||
t = acb_rel_one_accuracy_bits(a);
|
||||
input_accuracy = FLINT_MIN(input_accuracy, t);
|
||||
t = acb_rel_accuracy_bits(b);
|
||||
t = acb_rel_one_accuracy_bits(b);
|
||||
input_accuracy = FLINT_MIN(input_accuracy, t);
|
||||
input_accuracy = FLINT_MAX(input_accuracy, 0.0);
|
||||
|
||||
|
|
2
arb.h
2
arb.h
|
@ -307,6 +307,8 @@ arb_rel_accuracy_bits(const arb_t x)
|
|||
return -arb_rel_error_bits(x);
|
||||
}
|
||||
|
||||
slong arb_rel_one_accuracy_bits(const arb_t x);
|
||||
|
||||
ARB_INLINE slong
|
||||
arb_bits(const arb_t x)
|
||||
{
|
||||
|
|
|
@ -47,3 +47,19 @@ arb_rel_error_bits(const arb_t x)
|
|||
return result;
|
||||
}
|
||||
|
||||
slong arb_rel_one_accuracy_bits(const arb_t x)
|
||||
{
|
||||
if (arf_cmpabs_2exp_si(arb_midref(x), -1) < 0)
|
||||
{
|
||||
arb_t t;
|
||||
arf_init(arb_midref(t));
|
||||
arf_one(arb_midref(t));
|
||||
*arb_radref(t) = *arb_radref(x);
|
||||
return arb_rel_accuracy_bits(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
return arb_rel_accuracy_bits(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -321,6 +321,11 @@ Precision and comparisons
|
|||
Returns the effective relative accuracy of *x* measured in bits,
|
||||
equal to the negative of the return value from :func:`acb_rel_error_bits`.
|
||||
|
||||
.. function:: slong acb_rel_one_accuracy_bits(const acb_t x)
|
||||
|
||||
Given a ball with midpoint *m* and radius *r*, returns an approximation of
|
||||
the relative accuracy of `[\max(1,|m|) \pm r]` measured in bits.
|
||||
|
||||
.. function:: slong acb_bits(const acb_t x)
|
||||
|
||||
Returns the maximum of *arb_bits* applied to the real
|
||||
|
|
|
@ -444,6 +444,11 @@ Radius and interval operations
|
|||
Returns the effective relative accuracy of *x* measured in bits,
|
||||
equal to the negative of the return value from :func:`arb_rel_error_bits`.
|
||||
|
||||
.. function:: slong arb_rel_one_accuracy_bits(const arb_t x)
|
||||
|
||||
Given a ball with midpoint *m* and radius *r*, returns an approximation of
|
||||
the relative accuracy of `[\max(1,|m|) \pm r]` measured in bits.
|
||||
|
||||
.. function:: slong arb_bits(const arb_t x)
|
||||
|
||||
Returns the number of bits needed to represent the absolute value
|
||||
|
|
Loading…
Add table
Reference in a new issue