Double - precision floating - point format - wikipedia Double - precision floating - point format Double - precision floating - point format is a computer number format that occupies 8 bytes ( 64 bits ) in computer memory and represents a wide, dynamic range of values by using a floating point. Double - precision floating - point format usually refers to binary64, as specified by the IEEE 754 standard, not to the 64 - bit decimal format decimal64. In older computers, different floating - point formats of 8 bytes were used, e.g., GW - BASIC 's double - precision data type was the 64 - bit MBF floating - point format. Floating point precisions IEEE 754 16 - bit : Half ( binary16 ) 32 - bit : Single ( binary32 ), decimal32 64 - bit : Double ( binary64 ), decimal64 128 - bit : Quadruple ( binary128 ), decimal128 256 - bit : Octuple ( binary256 ) Extended precision formats ( 40 - bit or 80 - bit ) Other Minifloat Microsoft Binary Format IBM Floating Point Architecture Arbitrary precision Contents 1 IEEE 754 double - precision binary floating - point format : binary64 1.1 Exponent encoding 1.2 Endianness 1.3 Double - precision examples 1.4 Execution speed with double - precision arithmetic 2 Implementations 2.1 C and C++ 2.2 Common Lisp 2.3 JavaScript 2.4 Lua 3 See also 4 Notes and references IEEE 754 double - precision binary floating - point format : binary64 Double - precision binary floating - point is a commonly used format on PCs, due to its wider range over single - precision floating point, in spite of its performance and bandwidth cost. As with single - precision floating - point format, it lacks precision on integer numbers when compared with an integer format of the same size. It is commonly known simply as double. The IEEE 754 standard specifies a binary64 as having : Sign bit : 1 bit Exponent : 11 bits Significand precision : 53 bits ( 52 explicitly stored ) This gives from 15 to 17 significant decimal digits precision. If a decimal string with at most 15 significant digits is converted to IEEE 754 double - precision representation, and then converted back to a decimal string with the same number of digits, the final result should match the original string. If an IEEE 754 double - precision number is converted to a decimal string with at least 17 significant digits, and then converted back to double - precision representation, the final result must match the original number. The format is written with the significand having an implicit integer bit of value 1 ( except for special data, see the exponent encoding below ). With the 52 bits of the fraction significand appearing in the memory format, the total precision is therefore 53 bits ( approximately 16 decimal digits, 53 log ( 2 ) ≈ 15.955 ). The bits are laid out as follows : The real value assumed by a given 64 - bit double - precision datum with a given biased exponent e ( displaystyle e ) and a 52 - bit fraction is ( − 1 ) sign ( 1. b 51 b 50... b 0 ) 2 × 2 e − 1023 ( displaystyle ( - 1 ) ^ ( \text ( sign ) ) ( 1. b_ ( 51 ) b_ ( 50 )... b_ ( 0 ) ) _ ( 2 ) \times 2 ^ ( e-1023 ) ) or ( − 1 ) sign ( 1 + ∑ i = 1 52 b 52 − i 2 − i ) × 2 e − 1023 ( displaystyle ( - 1 ) ^ ( \text ( sign ) ) left ( 1 + sum _ ( i = 1 ) ^ ( 52 ) b_ ( 52 - i ) 2 ^ ( - i ) \right ) \times 2 ^ ( e-1023 ) ) Between 2 = 4,503,599,627,370,496 and 2 = 9,007,199,254,740,992 the representable numbers are exactly the integers. For the next range, from 2 to 2, everything is multiplied by 2, so the representable numbers are the even ones, etc. Conversely, for the previous range from 2 to 2, the spacing is 0.5, etc. The spacing as a fraction of the numbers in the range from 2 to 2 is 2. The maximum relative rounding error when rounding a number to the nearest representable one ( the machine epsilon ) is therefore 2. The 11 bit width of the exponent allows the representation of numbers between 10 and 10, with full 15 -- 17 decimal digits precision. By compromising precision, the subnormal representation allows even smaller values up to about 5 × 10. Exponent encoding The double - precision binary floating - point exponent is encoded using an offset - binary representation, with the zero offset being 1023 ; also known as exponent bias in the IEEE 754 standard. Examples of such representations would be : e = 00000000001 = 001 = 1 : 2 1 − 1023 = 2 − 1022 ( displaystyle 2 ^ ( 1 - 1023 ) = 2 ^ ( - 1022 ) ) ( smallest exponent for normal numbers ) e = 10000000101 = 405 = 1029 : 2 1029 − 1023 = 2 6 ( displaystyle 2 ^ ( 1029 - 1023 ) = 2 ^ ( 6 ) ) e = 11111111110 = 7fe = 2046 : 2 2046 − 1023 = 2 1023 ( displaystyle 2 ^ ( 2046 - 1023 ) = 2 ^ ( 1023 ) ) ( highest exponent ) The exponents 000 and 7ff have a special meaning : 00000000000 = 000 is used to represent a signed zero ( if F = 0 ) and subnormals ( if F ≠ 0 ) ; and 11111111111 = 7ff is used to represent ∞ ( if F = 0 ) and NaNs ( if F ≠ 0 ), where F is the fractional part of the significand. All bit patterns are valid encoding. Except for the above exceptions, the entire double - precision number is described by : ( − 1 ) sign × 2 e − 1023 × 1. fraction ( displaystyle ( - 1 ) ^ ( \text ( sign ) ) \times 2 ^ ( e-1023 ) \times 1. ( \text ( fraction ) ) ) In the case of subnormals ( e = 0 ) the double - precision number is described by : ( − 1 ) sign × 2 1 − 1023 × 0. fraction = ( − 1 ) sign × 2 − 1022 × 0. fraction ( displaystyle ( - 1 ) ^ ( \text ( sign ) ) \times 2 ^ ( 1 - 1023 ) \times 0. ( \text ( fraction ) ) = ( - 1 ) ^ ( \text ( sign ) ) \times 2 ^ ( - 1022 ) \times 0. ( \text ( fraction ) ) ) Endianness This section is transcluded from Endianness. ( edit history ) Although the ubiquitous x86 processors of today use little - endian storage for all types of data ( integer, floating point, BCD ), there are a few historical machines where floating - point numbers are represented in big - endian form while integers are represented in little - endian form. There are old ARM processors that have half little - endian, half big - endian floating - point representation for double - precision numbers : both 32 - bit words are stored in little - endian like integer registers, but the most significant one first. Because there have been many floating - point formats with no `` network '' standard representation for them, the XDR standard uses big - endian IEEE 754 as its representation. It may therefore appear strange that the widespread IEEE 754 floating - point standard does not specify endianness. Theoretically, this means that even standard IEEE floating - point data written by one machine might not be readable by another. However, on modern standard computers ( i.e., implementing IEEE 754 ), one may in practice safely assume that the endianness is the same for floating - point numbers as for integers, making the conversion straightforward regardless of data type. ( Small embedded systems using special floating - point formats may be another matter however. ) Double - precision examples 0 01111111111 0000000000000000000000000000000000000000000000000000 ≙ + 2 1 = 1 0 01111111111 0000000000000000000000000000000000000000000000000001 ≙ + 2 ( 1 + 2 ) ≈ 1.0000000000000002, the smallest number > 1 0 01111111111 0000000000000000000000000000000000000000000000000010 ≙ + 2 ( 1 + 2 ) ≈ 1.0000000000000004 0 10000000000 0000000000000000000000000000000000000000000000000000 ≙ + 2 1 = 2 1 10000000000 0000000000000000000000000000000000000000000000000000 ≙ − 2 1 = − 2 0 10000000000 1000000000000000000000000000000000000000000000000000 ≙ + 2 1.1 = 11 = 3 0 10000000001 0000000000000000000000000000000000000000000000000000 ≙ + 2 1 = 100 = 4 0 10000000001 0100000000000000000000000000000000000000000000000000 ≙ + 2 1.01 = 101 = 5 0 10000000001 1000000000000000000000000000000000000000000000000000 ≙ + 2 1.1 = 110 = 6 0 10000000011 0111000000000000000000000000000000000000000000000000 ≙ + 2 1.0111 = 10111 = 23 0 00000000000 0000000000000000000000000000000000000000000000000001 ≙ + 2 2 = 2 ≈ 4.9 10 ( Min. subnormal positive double ) 0 00000000000 1111111111111111111111111111111111111111111111111111 ≙ + 2 ( 1 − 2 ) ≈ 2.2250738585072009 10 ( Max. subnormal double ) 0 00000000001 0000000000000000000000000000000000000000000000000000 ≙ + 2 1 ≈ 2.2250738585072014 10 ( Min. normal positive double ) 0 11111111110 1111111111111111111111111111111111111111111111111111 ≙ + 2 ( 1 + ( 1 − 2 ) ) ≈ 1.7976931348623157 10 ( Max. Double ) 0 00000000000 0000000000000000000000000000000000000000000000000000 ≙ + 0 1 00000000000 0000000000000000000000000000000000000000000000000000 ≙ − 0 0 11111111111 0000000000000000000000000000000000000000000000000000 ≙ + ∞ ( positive infinity ) 1 11111111111 0000000000000000000000000000000000000000000000000000 ≙ − ∞ ( negative infinity ) 0 11111111111 1000000000000000000000000000000000000000000000000000 ≙ NaN 0 11111111111 1111111111111111111111111111111111111111111111111111 ≙ NaN ( an alternative encoding ) 0 01111111101 0101010101010101010101010101010101010101010101010101 = 3fd5 5555 5555 5555 ≙ + 2 ( 1 + 2 + 2 +... + 2 ) ≈ / By default, / rounds down, instead of up like single precision, because of the odd number of bits in the significand. In more detail : Given the hexadecimal representation 3FD5 5555 5555 5555, Sign = 0 Exponent = 3FD = 1021 Exponent Bias = 1023 ( constant value ; see above ) Fraction = 5 5555 5555 5555 Value = 2 × 1. Fraction -- Note that Fraction must not be converted to decimal here = 2 × ( 15 5555 5555 5555 × 2 ) = 2 × 15 5555 5555 5555 = 0.333333333333333314829616256247390992939472198486328125 ≈ 1 / 3 Execution speed with double - precision arithmetic Using double - precision floating - point variables and mathematical functions ( e.g., sin, cos, atan2, log, exp and sqrt ) are slower than working with their single precision counterparts. One area of computing where this is a particular issue is for parallel code running on GPUs. For example, when using NVIDIA 's CUDA platform, on video cards designed for gaming, calculations with double precision take 3 to 24 times longer to complete than calculations using single precision. Implementations Doubles are implemented in many programming languages in different ways such as the following. On processors with only dynamic precision, such as x86 without SSE2 ( or when SSE2 is not used, for compatibility purpose ) and with extended precision used by default, software may have difficulties to fulfill some requirements. C and C++ C and C++ offer a wide variety of arithmetic types. Double precision is not required by the standards ( except by the optional annex F of C99, covering IEEE 754 arithmetic ), but on most systems, the double type corresponds to double precision. However, on 32 - bit x86 with extended precision by default, some compilers may not conform to the C standard and / or the arithmetic may suffer from double - rounding issues. Common Lisp Common Lisp provides the types SHORT - FLOAT, SINGLE - FLOAT, DOUBLE - FLOAT and LONG - FLOAT. Most implementations provide SINGLE - FLOATs and DOUBLE - FLOATs with the other types appropriate synonyms. Common Lisp provides exceptions for catching floating - point underflows and overflows, and the inexact floating - point exception, as per IEEE 754. No infinities and NaNs are described in the ANSI standard, however, several implementations do provide these as extensions. JavaScript As specified by the ECMAScript standard, all arithmetic in JavaScript shall be done using double - precision floating - point arithmetic. Lua In Lua version 5.2 and earlier, all arithmetic is done using double - precision floating - point arithmetic ( explicit support for single - precision was added in version 5.3 ). Also, automatic type conversions between doubles and strings are provided ( and also between floating - point values and integers since version 5.3 ). See also IEEE floating point, IEEE standard for floating - point arithmetic ( IEEE 754 ) Notes and references Jump up ^ William Kahan ( 1 October 1997 ). `` Lecture Notes on the Status of IEEE Standard 754 for Binary Floating - Point Arithmetic '' ( PDF ). Jump up ^ `` Floating point formats ''. Jump up ^ `` pack -- convert a list into a binary representation ''. Jump up ^ http://www.tomshardware.com/reviews/geforce-gtx-titan-gk110-review,3438-3.html Jump up ^ GCC Bug 323 - optimized code gives strange floating point results Jump up ^ ECMA - 262 ECMAScript Language Specification ( PDF ) ( 5th ed. ). Ecma International. p. 29, § 8.5 The Number Type. Jump up ^ http://www.lua.org/manual/5.2/manual.html Data types Uninterpreted Bit Byte Trit Tryte Word Bit array Numeric Arbitrary - precision or bignum Complex Decimal Fixed point Floating point Double precision Extended precision Half precision Long double Minifloat Octuple precision Quadruple precision Single precision Integer signedness Interval Rational Pointer Address physical virtual Reference Text Character String null - terminated Composite Algebraic data type generalized Array Associative array Class Dependent Equality Inductive List Object metaobject Option type Product Record Set Union tagged Other Boolean Bottom type Collection Enumerated type Exception Function type Opaque data type Recursive data type Semaphore Stream Top type Type class Unit type Void Related topics Abstract data type Data structure Generic Kind metaclass Parametric polymorphism Primitive data type Protocol interface Subtyping Type constructor Type conversion Type system See also platform - dependent and independent units of information Retrieved from `` https://en.wikipedia.org/w/index.php?title=Double-precision_floating-point_format&oldid=800105383 '' Categories : Binary arithmetic Computer arithmetic Floating point types Talk Contents About Wikipedia Català Deutsch Español 日本 語 Norsk Português Русский Shqip Српски / srpski 中文 Edit links This page was last edited on 11 September 2017, at 14 : 59. Text is available under the Creative Commons Attribution - ShareAlike License ; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia ® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. About Wikipedia

Question: what is the default type for a floating point constant
Answer: binary64