From 250ea89c8ffb0778abc64ba722d180929c8482a5 Mon Sep 17 00:00:00 2001 From: Reinier Heeres Date: Sun, 25 Nov 2007 12:21:13 +0000 Subject: Fix log() of Rational number bug --- (limited to 'mathlib.py') diff --git a/mathlib.py b/mathlib.py index ff17de5..71deb65 100644 --- a/mathlib.py +++ b/mathlib.py @@ -187,7 +187,7 @@ class MathLib: return ret def is_int(self, n): - if type(n) is types.IntType: + if type(n) is types.IntType or type(n) is types.LongType: return True if not isinstance(n, Decimal): @@ -248,13 +248,13 @@ class MathLib: return self.d(math.exp(float(x))) def ln(self, x): - if x > 0: + if float(x) > 0: return self.d(math.log(float(x))) else: return 0 def log10(self, x): - if x > 0: + if float(x) > 0: return self.d(math.log10(float(x))) else: return 0 @@ -278,7 +278,6 @@ class MathLib: return self.d(math.sin(float(x * self.angle_scaling))) def cos(self, x): - _logger.debug('cos of %r, (%r)', x, self.angle_scaling) return self.d(math.cos(float(x * self.angle_scaling))) def tan(self, x): -- cgit v0.9.1