I have about 10-15 numbers with an accuracy of 1, 2 or 3 decimal places in my db, both signed and unsigned.
An example of using data types:
decimal(10,3), decimal(10,2), decimal(10,1)
I compute them in PHP like this:
$result = ($value1from_col1 + ($value2from_col2 * 30)/500) * 0.453;
Then I use some functions round(), such as:
$result_round = round($result, 2, PHP_ROUND_HALF_UP);
The result $result_roundwill be the biggest: 100.000999
I check this: How much accuracy is there for the bcmath library library? and the answer indicates that this will not be a problem if you do not use functions like round (), printf, etc.
Should I use the BCMath extension? (just because I use round())
source
share