I am getting a couple of values from a database query. The values that I am getting look like:
10.810000000000000497 and I want to use just ‘10.81’.
or
2.6899999999999999467 and I want to use just 2.69
when using ini_set('precision', 20);
How how should I use this values with bcadd() for example? As I just want to add 10.81 + 2.69?
The php BC_ functions has another option: scale.
If you want to use it several times you may use bcscale() and such you won’t need to specify the third option each time you use it: