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

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -