PHP Convert to int

孤者浪人 提交于 2019-12-12 06:58:46

问题


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

Thanks!!


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/1863461/php-convert-to-int

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!