[ python-Bugs-1053629 ] Why is this expression == False?

SourceForge.net noreply at sourceforge.net
Mon Oct 25 12:35:52 CEST 2004


Bugs item #1053629, was opened at 2004-10-25 12:09
Message generated for change (Comment added) made by doerwalter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1053629&group_id=5470

Category: None
Group: Python 2.3
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Alexander Rødseth (alexanro)
Assigned to: Nobody/Anonymous (nobody)
Summary: Why is this expression == False?

Initial Comment:
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. 

----------------------------------------------------------------------

>Comment By: Walter Dörwald (doerwalter)
Date: 2004-10-25 12:35

Message:
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

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1053629&group_id=5470


More information about the Python-bugs-list mailing list