Last active
December 18, 2015 05:59
-
-
Save coyotte508/5737059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pythran/pythonic++/modules/math.h b/pythran/pythonic++/modules/math.h | |
index 1701f47..df1f189 100644 | |
--- a/pythran/pythonic++/modules/math.h | |
+++ b/pythran/pythonic++/modules/math.h | |
@@ -1,6 +1,8 @@ | |
#ifndef PYTHONIC_MODULE_MATH_H | |
#define PYTHONIC_MODULE_MATH_H | |
+#include <gmpxx.h> | |
+ | |
namespace pythonic { | |
namespace math { | |
using std::acos; | |
@@ -74,6 +76,14 @@ namespace pythonic { | |
template<class T> | |
double radians(T x) { return (x * 2. * pi) / 360.; } | |
+ /* sqrt(mpz_class) returns an int, while a square of a long in python | |
+ * returns a floating point number. | |
+ * | |
+ * So even if it's ugly we have to convert the number to a float, */ | |
+ double sqrt(const mpz_class &mpz) { | |
+ return std::sqrt(mpz.get_d()); | |
+ } | |
+ | |
PROXY(pythonic::math,isinf); | |
PROXY(pythonic::math,modf); | |
PROXY(pythonic::math,frexp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment