Javascript: Printing floating point values with decimals and not with e- notation -


when print floating point 0.0000001 in javascript gives me

 1e-7 

how can avoid , instead print "normally" ?

you can use this:

var x = 0.00000001; var toprint = x.tofixed(7); 

this sets toprint string representation of x 7 digits right of decimal point. use this, need know how many digits of precision need. need trim off trailing 0 digits if don't want them (say, if x 0.04).


Comments

Popular posts from this blog

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -