c - got wrong reult when make division of large double data -


there code

double max = pow(2,1000); double test = max/10; 

the result test wrong result. want know how happened?

the issue precision of float numbers. stored in binary format , double can store 53+1 bits in mantissa.

when divide such big number 10, lose of bits it's not possible express division precisely in binary number.

actually it's impossible store 1/10 precisely, here original power of 2 doesn't matter much.

edit: regarding other answers - exponent can store 11 bits in double, it's able handle 2^1000.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -