Number primitive type in Javascript

Number primitive type in Javascript

As with any other language Javascript comes loaded with its primitive types. As per ECMAscript5 Javascript has number primitive type for dealing with integers, floating-points, double, long.

Well these are some fantasies of JAVA world(which depends on the precision of the number you want), but almost every language has these characteristics. Javascript don’t care about these, it references to all these as numbers.

However every number primitive type in javascript is “double precision 64-bit format IEEE 754 values”. Lots of buzzwords, just ignore it and remember that every number is of floating-point double precision format. Or, to be more simple, it’s a floating-point format and double-precision i.e. , more digits to the right of the decimal point. The term double precision is something of a misnomer because the precision is not really double. The word double derives from the fact that a double-precision number uses twice as many bits as a regular floating-point number. For example, if a single-precision number requires 32 bits, its double-precision counterpart will be 64 bits long. So, finally we got, double precision 64-bit format.

Leave a Reply

Your email address will not be published. Required fields are marked *