pow() cast to integer, unexpected result
Some investigation in assembly code. (OllyDbg) #include <stdio.h> #include <math.h> int main(void) { int x1 = (int) pow(10, 2); int x2 = (int) pow(10, 2); printf(“%d %d”, x1, x2); return 0; } The related assembly section: FLD QWORD PTR DS:[402000] // Loads 2.0 onto stack SUB ESP,8 FSTP QWORD PTR SS:[ESP] FLD QWORD PTR DS:[402008] … Read more