plz explain floating point number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

plz explain floating point number.

12th Apr 2020, 3:42 AM
Lazy Panda
Lazy Panda - avatar
5 Answers
+ 1
The float type represents the floating point number. Float is used to represent real numbers and is written with a decimal point dividing the integer and fractional parts. For example, 97.98, 32.3+e18, -32.54e100 all are floating point numbers.
12th Apr 2020, 3:46 AM
Ayush Dwivedi
Ayush Dwivedi - avatar
+ 1
yup.
12th Apr 2020, 3:48 AM
Ayush Dwivedi
Ayush Dwivedi - avatar
0
decimals are floting numbers ri8? bro
12th Apr 2020, 3:47 AM
Lazy Panda
Lazy Panda - avatar
0
thnks for the info bro.. 🙏
12th Apr 2020, 3:49 AM
Lazy Panda
Lazy Panda - avatar
0
The representation of floating points in JavaScript follows the IEEE-754 format. It is a double precision format where 64 bits are allocated for every floating point. The displaying of these floating values could be handled using 2 methods: Using toFixed() Method: The number of decimal places in float values can be set using the toFixed() method. This method converts the number into a string, keeping the specified number of digits after the point. If no value is passed as a parameter, then it takes 0 as default value i.e. no decimal points are displayed. Using toPrecision() Method: The number of total digits in float values can be set using the toPrecision() method. This method converts the number into a string, keeping the total number of digits of the value as specified and rounding them to the nearest number. If no value is passed as a parameter, then the function acts as a toString() function effectively returning the value passed as a string.
6th May 2020, 10:36 AM
ℤ𝕚𝕔𝕔𝕠
ℤ𝕚𝕔𝕔𝕠 - avatar