Closed palansher closed 2 years ago
Hello!
I am trying to check the corrections of rounding. This simple test must be passed:
1/7/13*7*13 = 1
But result discourages:
use Money\Money; $eur1 = Money::EUR(100); $result= $eur1->divide(7)->divide(13)->multiply(7)->multiply(13); echo $result->getAmount().PHP_EOL;
the result is 91 instead of 100 But even Windows 10 calculator app provides the correct answer =1.
also PHP:
<?php echo 1/7/13*7*13; // =1
How can I get the correct answer (=1)?
thank you for your work!
The answer 91 is correct. multiply and divide lose their decimal points, see the second argument you can pass for the rounding modes.
multiply
divide
Hello!
I am trying to check the corrections of rounding. This simple test must be passed:
1/7/13*7*13 = 1
But result discourages:
the result is 91 instead of 100 But even Windows 10 calculator app provides the correct answer =1.
also PHP:
How can I get the correct answer (=1)?
thank you for your work!