The best JavaScript Number Object Tutorial In 2024, In this tutorial you can learn JavaScript numbers,Examples,Examples,All the figures are 64 JavaScript,Accuracy,Examples,Octal and hexadecimal,Examples,Examples,Infinity (Infinity),Examples,Examples,NaN - non-numeric values,Examples,Examples,Digital may be a digital or an object,Examples,Examples,Digital Properties,Numerical Methods,
JavaScript is only one numeric type.
You can use the decimal point may not be used to write numbers.
JavaScript numbers may or may not use a decimal point to write:
Large or very small numbers through scientific (exponential) notation to write:
JavaScript is not the type of language. Unlike many other programming languages, JavaScript does not define different types of digital, such as integer, short, long, float, and so on.
In JavaScript, numbers are not divided into integer type and floating-point type, all figures are from the floating-point type. JavaScript uses IEEE754 standard defines a 64-bit floating-point digital format, it can represent a maximum of ± 1.7976931348623157 x 10308, the minimum value is ± 5 x 10 -324
Value (aka Fraction / Mantissa) | index | Sign |
---|---|---|
52 bits (0 - 51) | 11 bits (50 - 62) | 1 bit (63) |
Integer (no decimal point or exponential notation) up to 15.
The maximum number of decimal places is 17, but the floating-point arithmetic is not always 100% accurate:
If the prefix is 0, then the JavaScript will be interpreted as a numeric constant octal number, if the prefix is zero and "x", it is interpreted as a hexadecimal number.
Never write zeros before the number, unless you need to perform octal conversion. |
By default, JavaScript digit decimal display.
But you can use the toString () method to output hexadecimal, octal, binary.
When the digital result of the operation exceeds the number that can be represented in the upper JavaScript (overflow), the result is a special infinity (infinity) value, expressed in JavaScript to Infinity. Similarly, when a negative value exceeds the negative range of JavaScript can be represented, the result is negative infinity, in JavaScript to -Infinity indicates. Behavioral characteristics of infinite value, and we expect the same: based on their addition, subtraction, multiplication and division operation result is infinity (of course, retain their sign).
Division by zero also had unlimited:
NaN attribute is a special value representing non-numeric values. This property is used to indicate that a value is not a number. Number objects can be set to this value, indicating that it is not a numeric value.
You can use the isNaN () global function to determine whether a value is NaN values.
Division by zero is infinity, infinity is a number:
Private digital data can be initialized as x = 123;
JavaScript digital object initialization data, var y = new Number (123);