Take a look at this example in regular math:
<?php
$rate = 788.159;
$amount = 1182.2385;
var_dump($amount*(1/$rate));
and the answer is as expected:
float(1.5)
however when same is done in BCMath:
<?php
bcscale(12);
$rate = "788.159";
$amount = "1182.2385";
var_dump(bcmul($amount, bcdiv("1", $rate)));
the answer is always:
string(14) "1.499999999999"
While it should be precise "1.5"!
I have tried increase default scale value to 100, 200, 1000. I have tried increasing scale specifically for my bcdiv
call, but it doesn't want to give 1.5 as an answer in anyway.
Any help will be appreciated