math with bitcoin is giving me problems
$value = bcmul((float)$TotalMoney, $p,8);
$value = bcdiv((float)$Value, 100,8);
returns
When working with Bitcoin balances it is recommended to store amounts in a database in satoshis as an integer and then you can convert it back to 8 decimals when displaying it on the screen to users.
$amount = 0.0132;
$convert = $amount * 100000000;
// store in DB as the converted amount 1320000 as an integer
// when grabbing from DB convert it back
$databaseValue = 1320000;
$convertBack = $databaseValue / 100000000;
$display = number_format($convertBack, 8);
echo $display;
Use the exemple below to convert Scientific Notation to float/decimal on PHP:
echo sprintf('%f', floatval('-1.0E-5'));//default 6 decimal places
echo sprintf('%.8f', floatval('-1.0E-5'));//force 8 decimal places
echo rtrim(sprintf('%f',floatval(-1.0E-5)),'0');//remove trailing zeros
I just use number_format()
Actual situation on your PHP:
$n=pow(71663616,2);
echo $n //5.1356738581955E+15
Now calling the decimal notation:
$n=pow(71663616,2);
echo number_format($n) //5,135,673,858,195,456