?
Solved

conversion of Exponentials to Fractional Values using Javascript

Posted on 2005-05-13
4
Medium Priority
?
655 Views
Last Modified: 2012-08-14
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

0
Comment
Question by:ramsharma23
3 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 1000 total points
ID: 13994448
Try to use toFixed()

example:

<script type="text/javascript">
var variable = 1.00343500000000;
document.write(variable.toFixed(4));
</script>
0
 
LVL 8

Assisted Solution

by:NETTY4
NETTY4 earned 1000 total points
ID: 13994544
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
 
LVL 17

Expert Comment

by:Cem Türk
ID: 15703496
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question