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
132132-------------
133133
134134Next 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 ` .
136137- [ gh-148 ] ( https://github.com/flintlib/python-flint/pull/148 )
137138 Remove debug symbols to make smaller Linux binaries.
138139- [ 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":
183183 void arb_log_ui(arb_t z, ulong x, long prec)
184184 void arb_log_fmpz(arb_t z, const fmpz_t x, long prec)
185185 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)
186187 void arb_exp(arb_t z, const arb_t x, long prec)
187188 void arb_expm1(arb_t z, const arb_t x, long prec)
188189 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):
14031403 def rel_one_accuracy_bits (self ):
14041404 return acb_rel_one_accuracy_bits(self .val)
14051405
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+
14061414 def ei (s ):
14071415 r """
14081416 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):
809809 arb_log1p((< arb> u).val, (< arb> s).val, getprec())
810810 return u
811811
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+
812822 def sin (s ):
813823 r """
814824 Sine function `\s in( s) `.
@@ -2416,6 +2426,14 @@ cdef class arb(flint_scalar):
24162426 def rel_one_accuracy_bits (self ):
24172427 return arb_rel_one_accuracy_bits(self .val)
24182428
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+
24192437 def lambertw (s , int branch = 0 ):
24202438 r """
24212439 Lambert * W* function, `W_k( s) `. Either the principal
You can’t perform that action at this time.
0 commit comments