Using the bcmath functions correctly

401 Views Asked by At

I've never used the bcmath figures before and having been doing a bit of reading about comparing and manipulating floating point numbers and this has led me to the bcmath functions.

I understand you definitely should use something like the bccomp function when comparing floating point numbers as even if the numbers look the same, they may not be stored the same internally; but is it really necessary to use the other bc functions?

Like what harm is there in adding two floating point numbers together or doing any other math on them? Aren't the floating point figures correct (apart from possibly the last digit if you have a high precision) and thus can be manipulated as you like?

0

There are 0 best solutions below