Skip to content

Commit 348ebfb

Browse files
#37794 log(0,2) shouldn't hang
1 parent f48da11 commit 348ebfb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/sage/misc/functional.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,13 @@ def log(*args, **kwds):
11371137
11381138
sage: log(0, 2)
11391139
-Infinity
1140+
1141+
Check if :issue:`37794` is fixed::
1142+
1143+
sage: log(int(0), 2)
1144+
-Infinity
1145+
sage: log(int(0), 1/2)
1146+
+Infinity
11401147
"""
11411148
base = kwds.pop('base', None)
11421149
if base:

src/sage/symbolic/ginac/numeric.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3688,6 +3688,9 @@ const numeric numeric::ratlog(const numeric &b, bool& israt) const {
36883688
israt = false;
36893689
return *_num0_p;
36903690
}
3691+
if (v._long == 0) {
3692+
return py_funcs.py_eval_neg_infinity();
3693+
}
36913694
int c = 0;
36923695
std::ldiv_t ld;
36933696
ld.quot = v._long;

0 commit comments

Comments
 (0)