Message166493
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));
} |
|
Date |
User |
Action |
Args |
2012-07-26 16:48:36 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, rhettinger, mark.dickinson, pitrou, ezio.melotti, r.david.murray, skrah, Ramchandra Apte, serhiy.storchaka, andrea.bergamini |
2012-07-26 16:48:36 | amaury.forgeotdarc | set | messageid: <1343321316.88.0.0411400412205.issue15438@psf.upfronthosting.co.za> |
2012-07-26 16:48:36 | amaury.forgeotdarc | link | issue15438 messages |
2012-07-26 16:48:36 | amaury.forgeotdarc | create | |
|