Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Exponent to number

How to convert an exponential value to numeric value using java script
Ex:
1.700000000000001e+308 converted to be its numeric value.

• Originally Posted by varalakshmi
How to convert an exponential value to numeric value using java script
Ex:
1.700000000000001e+308 converted to be its numeric value.

Code:
```<script type = "text/javascript">

var x  = (1.23e+20).toFixed(6);    // Returns "123000000000000000000.000000" - note added zeroes
var y = (1.23e-10).toFixed(2);    // Returns "0.00"

</script>```
1.700000000000001e+308 is too large a number for Javascript to handle.

It is not as cold as it was yesterday, but that's probably because it's a bit warmer. - BBC Scotland News.

• Originally Posted by Philip M
1.700000000000001e+308 is too large a number for Javascript to handle.
Ummm...actually, the largest number JS can handle is a tad larger than that.

1.7976931348623157 e +308

I *think* what Philip means is that JS can't convert a number that large to NON-scientific notation.

If it were converted, it would be 309 digits long. No human could make sense of it, so the scientific notation is much better for this purpose.

I only tested on Chrome, but the largest exponent JS will convert to fixed notation in Chrome is e+20. After that, it reverts to always using scientific notation.

• Originally Posted by Old Pedant
Ummm...actually, the largest number JS can handle is a tad larger than that.

1.7976931348623157 e +308

I *think* what Philip means is that JS can't convert a number that large to NON-scientific notation.

If it were converted, it would be 309 digits long. No human could make sense of it, so the scientific notation is much better for this purpose.

I only tested on Chrome, but the largest exponent JS will convert to fixed notation in Chrome is e+20. After that, it reverts to always using scientific notation.
Yes, that was what I intended to convey. The number is too big to be displayed other than in scientific notation.

• I'd start by using parseFloat to convert thoose strings to numbers - as that's what parseFloat is for.

If you did that then numbers too big for JavaScript to handle would report as infinity rather than as zero.

•