I want to use bcmath for precise operations with very small numbers, but it fails. I am trying to calculate cryptocurrency prices and thought that bcmath is better than converting float to integers
This working:
php > echo number_format(0.000005 * 0.0025, 10);
0.0000000125
And this is not working:
php > echo number_format(bcmul(0.000005, 0.0025, 10), 10);
0.0000000000
php > echo number_format(bcadd(0.000005, 0.00000025, 10), 10);
0.0000000000
Is there some configurations for bcmath or this is normal behavior?