Amaury Forgeot d'Arc <[email protected]> added the comment:
C comparison rules are different from Python's.
In the program below (which outputs 1), the mixed comparison will first convert
the literal to a double, and lost some precision.
Python does the opposite: the (imprecise) float is converted to a long, so all
digits are compared.
#include <math.h>
#include <stdio.h>
int main()
{
printf("result: %d\n", (pow(43,10) == 21611482313284249));
}
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15438>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com