C Math pow(): unexpected results -
this question has answer here:
- pow() seems out 1 here 4 answers
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
Post a Comment