When I print this number in php 137582392964679 , I get this as output 1.37582392965E + 14
All I do is simple
print 137582392964679;
Does anyone know why he is doing this? It is as if it is automatically converted to an exponential number. Someone said this because I'm on a 32-bit machine. If so, how can I get around this?
thank
Check const PHP_INT_MAX. You probably exceeded the maximum size, which is usually around 2 billion for a 32-bit system.
, 32- , 2147483647. , , , .
, ?
, . GMP:
$sum = gmp_add("123456789012345", "76543210987655"); echo gmp_strval($sum) . "\n";
:
200000000000000
, , - BC Math.
- , , , .
64- , . , : print number_format(137582392964679);
print number_format(137582392964679);
, 32- , , . . , . , float printf. , 64-, , , , BC Math PHP.
manual :
PHP , float.
Also, your number cannot be represented exactly because of the inherent limitations of floating point, therefore, it is approaching.
Source: https://habr.com/ru/post/1781522/More articles:to find the rotation of one image relative to another - matlabDelphi custom components used in the project when tpropertyeditor is involved - delphiПредотвращение условий гонки - ajaxDataType.Currency attribute does not work on $ sign - asp.net-mvcCursor style not updating - c ++How to debug Javascript in old browsers - javascriptBtree implementation - javaAndroid development with Samsung Galaxy tablet - androidEclipse CDT: org.eclipse.cdt.internal.ui.text.CReconciler, java.lang.OutOfMemoryError - eclipseStart a thread using a method pointer - c ++All Articles