Mega Code Archive

 
Categories / JavaScript Tutorial / Number Data Type
 

Floating-point values can be represented using e-notation

In e-notation, a number is represented by digits, followed by an e or an E, followed by the number of times to multiply it by 10. var fNum = 3.125e7; This notation represents the number 31250000. You can get this value by converting the e-notation to a calculation: 3.125 * 10^7. 0.00000000000000003 can be written as 3e-17. Here, 10 is raised to the -17 power. By default, JavaScript converts any floating-point number with six or more leading zeros into e-notation. Floating-point values are stored in a 64-bit IEEE 754 format. Decimal values can have up to 17 decimal places. After that, the values are truncated.