I’m using the Woocommerce Deposits plugin. It uses percentages to calculate the deposit and payment. I need the deposit and payment to be an exact amount. I can calculate the exact percentages to give the exact amount but the plugin does not allow decimal points for the percentages. It rounds up or down to a whole number. Example: I need
Tag: precision
How can I make sure a float will always be rounded up with PHP?
I want to make sure a float in PHP is rounded up if any decimal is present, without worrying about mathematical rounding rules. This function would work as follows: 1.1 to 2 1.2 to 2 1.9 to 2 2.3 to …
PHP and unit testing assertions with decimals
I have a method that returns a float like 1.234567890.I want to test that it really does so. However, it seems that this returned float has different precision on different platforms so how do I …