Difference between revisions of "Double"

From Lazarus wiki
Jump to navigationJump to search
(deduplicated to Single)
Line 1: Line 1:
{{Double}}
+
#REDIRECT [[Single]]
 
 
Double is IEEE 754 double-precision binary floating-point format.
 
 
 
Value range: 5.0E-324 .. 1.7E308 <br>
 
Accuracy: 15 to 17 significant decimal digits precision <br>
 
Memory requirement: 8 bytes or [[64 bit]]s <br>
 
Property: The double- data-type data field can hold floating-point values ​​and signed and unsigned integer values.
 
Assigning other values ​​will result in error messages from the compiler when the program is compiled, and the compile will be aborted. That is, the executable program is not created.
 
 
 
Definition of a data field of data type double:
 
<source>
 
  var
 
    d : Double ;
 
</source>
 
 
 
Examples of assigning valid values:
 
 
 
<source>
 
    d : = - 123.45678 ;
 
    d : = 0 ;
 
    d : = 123.45678 ;
 
</source>
 
 
 
Examples of assigning invalid values:
 
 
 
<source>
 
    d : = '-123.45678' ;
 
    d : = '0' ;
 
    d : = '123.45678' ;
 
</source>
 
 
 
The difference between the two examples is that the upper example is the assignment of Integer and FloatingCommand literals, while the assignment of the lower example is literals of the String type.
 
 
 
== Binary floating-point format==
 
 
 
Any value stored as a double requires 64 bits, formatted as shown in the table below:
 
 
 
 
 
 
 
{| class="wikitable"
 
! Bits
 
! Usage
 
|-
 
| 63
 
| Sign (0 = positive, 1 = negative)
 
|-
 
| 62 to 52
 
| Exponent, biased by 1023
 
|-
 
| 51 to 0
 
| Fraction f of the number 1.f
 
|}
 

Revision as of 15:00, 28 March 2018

Redirect to: