File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2851,16 +2851,24 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
2851
2851
sage: ZZ( 8) . log( int( 2))
2852
2852
3
2853
2853
2854
+ Check that negative bases yield complex logarithms ( :issue:`39959`) ::
2855
+
2856
+ sage: 8. log( -2)
2857
+ 3* log( 2) /( I* pi + log( 2))
2858
+
2859
+ Check that zero base yield complex logarithms ( :issue:`39959`) ::
2860
+
2861
+ sage: 8. log( 0)
2862
+ 0
2863
+
2854
2864
TESTS::
2855
2865
2856
2866
sage: ( -2) . log( 3) # needs sage. symbolic
2857
2867
( I* pi + log( 2)) /log( 3)
2858
2868
"""
2859
2869
cdef int self_sgn
2860
- if m is not None and m <= 0 :
2861
- raise ValueError (" log base must be positive" )
2862
2870
self_sgn = mpz_sgn(self .value)
2863
- if self_sgn < 0 and prec is None :
2871
+ if ( self_sgn < 0 or m <= 0 ) and prec is None :
2864
2872
from sage.symbolic.ring import SR
2865
2873
return SR(self ).log(m)
2866
2874
if prec:
You can’t perform that action at this time.
0 commit comments