conversion of Exponentials to Fractional Values using Javascript

How to convert exponential to Fraction Values.


The floating point values are shown in Exponentioal Form.

For Ex :
1 E-4  should be shown in Webpage as .0001

ramsharma23Asked:
Who is Participating?
 
BatalfConnect With a Mentor Commented:
Try to use toFixed()

example:

<script type="text/javascript">
var variable = 1.00343500000000;
document.write(variable.toFixed(4));
</script>
0
 
NETTY4Connect With a Mentor Commented:
In my tests I did get the conversion down to 1E-6 without toFixed() conversion.
And if you need to read in the number, then use parseFloat().
Like this:
<script>
alert(parseFloat("1E-4"))
</script>

0
 
Cem TürkSenior Software EngineerCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Split between Batalf and NETTY4

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cem_turk
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.