Created
May 18, 2019 06:39
-
-
Save space-cadet/1d86ce7d55740b695bded2a928d3bcff to your computer and use it in GitHub Desktop.
Result of math overflow error in Python
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
recursive_func(Quaternion.random(), 10, Quaternion.exp) | |
0.401 +0.349i +0.310j +0.182k | |
1.309 +0.500i +0.443j +0.260k | |
2.792 +1.698i +1.504j +0.884k | |
-12.401 +7.391i +6.550j +3.847k | |
-0.000 -0.000i -0.000j -0.000k | |
1.000 -0.000i -0.000j -0.000k | |
2.718 -0.000i -0.000j -0.000k | |
15.154 -0.000i -0.000j -0.000k | |
3814029.270 -415.916i -368.566j -216.488k | |
--------------------------------------------------------------------------- | |
OverflowError Traceback (most recent call last) | |
<ipython-input-16-7b7585737b8a> in <module> | |
----> 1 recursive_func(Quaternion.random(), 10, Quaternion.exp) | |
<ipython-input-15-bee1b782b391> in recursive_func(q, ntimes, func) | |
1 def recursive_func(q, ntimes, func): | |
2 for i in range(ntimes): | |
----> 3 q = func(q) | |
4 print(q) | |
5 return | |
~/ownCloud/root/code/ipython-notebooks/research/julia/pyquaternion/pyquaternion/quaternion.py in exp(cls, q) | |
642 if v_norm > tolerance: | |
643 vec = vec / v_norm | |
--> 644 magnitude = exp(q.scalar) | |
645 return Quaternion(scalar = magnitude * cos(v_norm), vector = magnitude * sin(v_norm) * vec) | |
646 | |
OverflowError: math range error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment