Issue1053629
Created on 2004-10-25 10:09 by alexanro, last changed 2004-10-27 03:35 by tim_one. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg22846 - (view) | Author: Alexander Rødseth (alexanro) | Date: 2004-10-25 10:09 | |
I am not sure if this is a bug or not, but I'm very curious of the reason for the following result: >>> from math import * >>> theta = pi >>> e**(complex(0,1)*theta)==cos(theta)+complex(0,1)*sin(theta) False This is supposed to be True, unless I've made some typo or made some other mistake. It's a version of Euler's equation. |
|||
| msg22847 - (view) | Author: Walter Dörwald (doerwalter) * ![]() |
Date: 2004-10-25 10:35 | |
Logged In: YES user_id=89016 This is due to rounding errors: >>> from math import * *>>> e**(1j*pi) (-1+1.2246063538223773e-16j) *>>> cos(pi)+1j*sin(pi) (-1+1.2246063538223773e-16j) Closing the bug report |
|||
| msg22848 - (view) | Author: Michael Hudson (mwh) ![]() |
Date: 2004-10-25 11:09 | |
Logged In: YES user_id=6656 Heh. Walter, the two numbers you show are in fact equal. Also, the expression is True for me. I wonder what platform Alexander is on -- but not very much, attempting to verify equalities involving transcedental quantities using finite precision arithmetic is always going to be risky. |
|||
| msg22849 - (view) | Author: Tim Peters (tim_one) * ![]() |
Date: 2004-10-27 03:35 | |
Logged In: YES user_id=31435 Try this one: >>> 37.0 / 3 / 3 * 9 == 37.0 False Worry about transcendentals after making peace with basic float arithmetic <wink>. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2004-10-25 10:09:23 | alexanro | create | |
