0

look at this code

var x=2E-7
console.log(x);

when i run it result will be 2E-7 instead of 20000000

why?is it a bug or sth else?

Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90
sr t
  • 1
  • 1
    No, `20000000` would be a bug. `2E-6` gives `0.000002`. It's just representing the number differently for readability, that's all. `2e-7` and `0.0000002` are the same numbers, why does it matter how the are *printed*? – Felix Kling May 22 '12 at 19:42
  • 2
    Seems like a duplicate of [this question](http://stackoverflow.com/questions/1685680/how-to-avoid-scientific-notation-for-large-numbers-in-javascript) – Paul Phillips May 22 '12 at 19:42
  • yes you're right 2e-6 would be .0000002.that was a typo.i know what are you talking about but why when x=2e7 it prints 2000000 but 2e-7 it prints out 2e-7. – sr t May 22 '12 at 19:52

1 Answers1

0

2E-7 is 2 * 10^-7

AKA 0.0000002

2E7 is 2 * 10^7

AKA 20000000

Codeman
  • 12,157
  • 10
  • 53
  • 91