File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,8 @@ CHANGELOG
132
132
-------------
133
133
134
134
Next release:
135
-
135
+ - [ gh-160 ] ( https://github.com/flintlib/python-flint/pull/160 )
136
+ Add ` bits ` to ` arb ` and ` acb ` , add ` log_base ` to ` arb ` .
136
137
- [ gh-148 ] ( https://github.com/flintlib/python-flint/pull/148 )
137
138
Remove debug symbols to make smaller Linux binaries.
138
139
- [ gh-144 ] ( https://github.com/flintlib/python-flint/pull/144 )
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ cdef extern from "flint/arb.h":
183
183
void arb_log_ui(arb_t z, ulong x, long prec)
184
184
void arb_log_fmpz(arb_t z, const fmpz_t x, long prec)
185
185
void arb_log1p(arb_t z, const arb_t x, long prec)
186
+ void arb_log_base_ui(arb_t z, const arb_t x, ulong b, long prec)
186
187
void arb_exp(arb_t z, const arb_t x, long prec)
187
188
void arb_expm1(arb_t z, const arb_t x, long prec)
188
189
void arb_sin(arb_t s, const arb_t x, long prec)
Original file line number Diff line number Diff line change @@ -1403,6 +1403,14 @@ cdef class acb(flint_scalar):
1403
1403
def rel_one_accuracy_bits (self ):
1404
1404
return acb_rel_one_accuracy_bits(self .val)
1405
1405
1406
+ def bits (self ):
1407
+ r """ Returns maximum of :meth:`. arb. bits` called on real and imaginary part.
1408
+
1409
+ >>> acb( "2047/2048") . bits( )
1410
+ 11
1411
+ """
1412
+ return acb_bits(self .val)
1413
+
1406
1414
def ei (s ):
1407
1415
r """
1408
1416
Exponential integral `\o peratorname{Ei}( s) `.
Original file line number Diff line number Diff line change @@ -809,6 +809,16 @@ cdef class arb(flint_scalar):
809
809
arb_log1p((< arb> u).val, (< arb> s).val, getprec())
810
810
return u
811
811
812
+ def log_base (s , ulong b ):
813
+ r """ Returns `\l og_b( s) `, computed exactly when possible.
814
+
815
+ >>> arb( 2048) . log_base( 2)
816
+ 11. 0000000000000
817
+ """
818
+ u = arb.__new__ (arb)
819
+ arb_log_base_ui((< arb> u).val, (< arb> s).val, b, getprec())
820
+ return u
821
+
812
822
def sin (s ):
813
823
r """
814
824
Sine function `\s in( s) `.
@@ -2416,6 +2426,14 @@ cdef class arb(flint_scalar):
2416
2426
def rel_one_accuracy_bits (self ):
2417
2427
return arb_rel_one_accuracy_bits(self .val)
2418
2428
2429
+ def bits (self ):
2430
+ r """ Returns number of bits needed to represent absolute value of mantissa of the midpoint; returns 0 if midpoint is special value.
2431
+
2432
+ >>> arb( "2047/2048") . bits( )
2433
+ 11
2434
+ """
2435
+ return arb_bits(self .val)
2436
+
2419
2437
def lambertw (s , int branch = 0 ):
2420
2438
r """
2421
2439
Lambert * W* function, `W_k( s) `. Either the principal
You can’t perform that action at this time.
0 commit comments