php - Floating number calculation -


this question has answer here:

i have 2 floats:

time1: 0.009925  time2: 0.01 

when return time1 - time2 this:

difference -7.5e-5 

time2 - time1 returns 7.5e-5 well.

how return normal float?

try number_format http://us3.php.net/number-format

echo number_format(0.009925 - 0.01,5); //-0.00008 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -