Last active
July 13, 2016 15:00
-
-
Save phpdave/96acbef913db99598b1fd82bbea18aee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$myFloat = (float)0.0; | |
for($i=0;$i<25000;$i++) | |
{ | |
$myFloat += 10000.10; | |
} | |
var_dump($myFloat); // float(250002499.9999) | |
//Try the BCMath Arbitrary Precision Mathematics extension | |
<?php | |
$myFloat = (float)0.0; | |
for($i=0;$i<25000;$i++) | |
{ | |
$myFloat = bcadd($myFloat,10000.1,1); | |
} | |
var_dump($myFloat);//string(11) "250002500.0" | |
?> | |
//Try the GNU Multiple Precision extension | |
/* | |
$myFloat = (float)0.0; | |
for($i=0;$i<25000;$i++) | |
{ | |
$myFloat gmp_add($myFloat,10000.1,1); | |
} | |
var_dump($myFloat); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment