Name
Double Type
Syntax
type Double;
Description
The Double type is an IEEE standard floating-point
type that uses 8 bytes to store a sign bit, an 11-bit exponent, and a
52-bit mantissa. The mantissa is usually normalized, that is, it has
an implicit 1 bit before the most significant bit. If the exponent is
zero, however, the mantissa is denormalized—without the
implicit 1 bit. Thus, the numerical value of +0.0 is represented by
all zero bits. An exponent of all 1 bits represents infinity
(mantissa is zero) or not-a-number (mantissa is not zero).
The limits of the Double type are approximately
2.23 × 10-308 to 1.79 × 10308,
with about 15 decimal digits of precision. Table 5-1 shows the detailed format of finite and
special Double values.
|
Numeric class |
Sign |
Exponent Bits |
Mantissa Bits |
|
Positive | |||
|
Normalized |
0 |
0...1 to 1...10 |
0...0 to 1...1 |
|
Denormalized |
0 |
0...0 |
0...1 to 1...1 |
|
Zero |
0 |
0...0 |
0...0 |
|
Infinity |
0 |
1...1 |
0...0 |
|
Signaling NaN |
0 |
1...1 |
0...1 to 01...1 |
|
Quiet NaN |
0 |
1...1 |
1...0 to 1...1 |
|
Negative | |||
|
Normalized |
1 |
0...1 to 1...10 |
0...0 to 1...1 |
|
Denormalized |
1 |
0...0 |
0...1 to 1...1 |
|
Zero |
1 |
0...0 |
0...0 |
|
Infinity |
1 |
1...1 |
0...0 |
|
Signaling NaN |
1 |
1...1 |
0...1 to 01...1 |
|
Quiet NaN |
1 |
1...1 |
1...0 to 1...1 |
Tips and Tricks
Doubleis a popular type that provides a good balance between performance and precision.The
Doubletype corresponds to thedoubletype in Java, C, and C++.Refer to the Intel architecture ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access