0

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?

Brett
  • 19,449
  • 54
  • 157
  • 290
  • Floating point math is imprecise with not always predictable results (unless you know the IEEE spec inside out, which hardly anyone does). If you don't care about that, fine. However, if you need *precise* decimal math, you'll want bc. Anything else unclear? – deceze Nov 13 '14 at 15:41
  • @deceze add your comment as an answer so it can be accepted and voted. – PhoneixS Jan 15 '15 at 11:22

0 Answers0