views:

146

answers:

3

Hi, Im not sure what this type of number is '1.3122278540256E+18' but how can i expand it into an integer?

Thanks!!

+2  A: 

It is in IEEE floating point notation. It is a number too large to be calcuated exactly, but move the decimal +18 places to the right to get the integer.

Byron Whitlock
+3  A: 

That's a floating-point number expressed in scientific notation (the "E+18" means "times 10 to the 18th power"). Chances are it's being displayed that way due to its length; you might try using printf to format it as a standard integer.

Amber
+1 for the printf idea.
Byron Whitlock
+1  A: 

This is scientific notation.

E+18 is shorthand for 10^18. In this case, the number you see is 1,312,227,854,025,600,000.

Dan Loewenherz