, :
$left = floor(log10($x))+1;
10, .
. , - :
$decimal = $x - floor($x);
$right = 0;
while (floor($decimal) != $decimal) {
$right++;
$decimal *= 10; //will bring in floating point 'noise' over time
}
10, . floor($decimal) != $decimal.
, , 155.11 ( ), 14. , 155.11000000000001 32 .
. ( PoPoFibo PHP, float).
, 155.11 155.11000000000001. , . . , , , , "", :
$x = 155.11;
$LIMIT = 10;
$right = 0;
$empty = 0;
while (floor($x) != $x) {
$right++;
$base = floor($x);
$x *= 10;
$base *= 10;
$digit = floor($x) - $base;
if ($digit == 0) {
$empty += 1;
if ($empty == $LIMIT) {
$right -= $empty;
break;
}
} else {
$zeros = 0;
}
}
, , 10 , .
, - PopoFibo , - PHP - , .