Saturday 24 August 2013

php / mysql divide result displays as 6.2E-5

php / mysql divide result displays as 6.2E-5

Have such mysql query SELECT CurrencyRate/Units AS FinalCurrencyRate
Value for CurrencyRate is 0.06200000 and value for Units is 1000.
So 0.06200000 / 1000 and get 6.2E-5
The same result if echo $result = 0.06200000 / 1000 . '<br>';
If echo $result = number_format( (0.06200000 / 1000), 10, '.', '' ) .
'<br>'; then can get 0.0000620000
What is solution for mysql query to get normal number instead of 6.2E-5?
Found round(CurrencyRate/Units,10)
But what if do not know number of 00000 after decimal? For example
0.06200000 / 1000000000000000000

No comments:

Post a Comment