C Math pow(): unexpected results -


this question has answer here:

consider following code:

#include <math.h> #include <stdio.h> int main() {     printf("%f\n", pow(43,10)); } 

this outputs: 21611482313284248.000000

see http://codepad.org/esa4asf2 playground.

but if run operation windows calculator (x^y function) result: 21611482313284249

what's happening??

in ieee-754, double (binary-64) can represent integers 9007199254740992 (that 2 power 53). after not integer numbers can represented in double. number 21611482313284249 greater 9007199254740992 , cannot represented in double.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -