float
は計算の精度を損なわず、 number_format
出力...
Notes:
It's really depend on your needs and how you want your output handled, if you wish just cutting the mantissa after second number or do some kind of rounding.
たとえば 2.10/1.10
のようなスケール2のBC Mathを使用すると、使用中に 1.90
が生成されます
number_format(2.10/1.10,2) 1.91
( SELECT CAST(DECIMAL(10,2)として2.10/1.10のように)/code>)
Update:.
As stated in comments there may be cases you will lose precision in calculations.
It will be probably better to do arbitrary-precision calculations in MySQL itself so you can be sure nothing is loosed during math operations.