DOUBLE: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''DOUBLE''' variables are 64-bits floating point numerical values up to sixteen digits precision ([[Wikipedia:Double-precision_floating-point_format|see IEEE 754 Double precision]]). | |||
{{PageSyntax}} | {{PageSyntax}} | ||
: [[DIM]] {{Parameter|variable}} [[AS]] [[DOUBLE]] | ; Explicit declaration | ||
: [[DIM]] {{Parameter|variable}} [[AS]] [[DOUBLE]] 'AS type variant | |||
: [[DIM]] {{Parameter|variable}}# 'type suffix variant ('''#''') | |||
; Implicit for a specific letter range | |||
: [[DEFDBL]] D-E '(legacy variant) all variables beginning with D(d) or E(e) | |||
: [[_DEFINE]] D-E [[AS]] [[DOUBLE]] 'new variant in QB64(PE) | |||
; Implicit without declaration | |||
: {{Parameter|variable}}# 'simply always use the type suffix | |||
{{PageDescription}} | {{PageDescription}} | ||
* | * Values can range up to 16 digits. Decimal point accuracy depends on whole value places taken. | ||
* The | * The suffix '''#''' can also be placed after a literal numerical value to designate the value as '''DOUBLE'''. | ||
* Values may be given as real number (''123.456'') or [[scientific notation]] using '''D''' as exponent marker (''1.23456D+2''). | |||
* Values | * [[PRINT]] usually takes the shorter of both notations (depending on the value) to output the numbers. In alternative you may use [[PRINT USING]] to designate your desired output format. | ||
* Floating decimal point numerical values cannot be [[_UNSIGNED]]. | * Floating decimal point numerical values cannot be [[_UNSIGNED]]. | ||
* Values can be converted to 8 | * Values can be converted to 8-bytes [[STRING]] values using [[_MKD$]] and back to numbers with [[_CVD]]. | ||
; Some useful [[constants]] are available since QB64-PE v4.0.0 | |||
* ' | :* _SIZE_OF_DOUBLE = 8 'in bytes | ||
:* _DOUBLE_MIN# = -1.797693134862315D+308 'smallest normal number | |||
:* _DOUBLE_MAX# = 1.797693134862315D+308 'largest normal number | |||
:* _DOUBLE_MIN_FRAC# = 2.225073858507201D-308 'smallest normal number closest to zero | |||
=== | |||
{{PageAvailability}} | |||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
<gallery widths="48px" heights="48px" mode="nolines"> | |||
File:Qb64.png|'''all''' | |||
File:Qbpe.png|'''all''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- additional availability notes go below here --> | |||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[SINGLE]], [[_FLOAT]] | * [[SINGLE]], [[_FLOAT]] | ||
* [[LEN]] | * [[DIM]], [[DEFDBL]], [[_DEFINE]] | ||
* [[MKD$]], [[CVD]], [[_MK$]], [[_CV]] | |||
* [[LEN]], [[Constants]] | |||
* [[Variable Types]] | * [[Variable Types]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 14:20, 25 December 2024
DOUBLE variables are 64-bits floating point numerical values up to sixteen digits precision (see IEEE 754 Double precision).
Syntax
- Explicit declaration
- DIM variable AS DOUBLE 'AS type variant
- DIM variable# 'type suffix variant (#)
- Implicit for a specific letter range
- DEFDBL D-E '(legacy variant) all variables beginning with D(d) or E(e)
- _DEFINE D-E AS DOUBLE 'new variant in QB64(PE)
- Implicit without declaration
- variable# 'simply always use the type suffix
Description
- Values can range up to 16 digits. Decimal point accuracy depends on whole value places taken.
- The suffix # can also be placed after a literal numerical value to designate the value as DOUBLE.
- Values may be given as real number (123.456) or scientific notation using D as exponent marker (1.23456D+2).
- PRINT usually takes the shorter of both notations (depending on the value) to output the numbers. In alternative you may use PRINT USING to designate your desired output format.
- Floating decimal point numerical values cannot be _UNSIGNED.
- Values can be converted to 8-bytes STRING values using _MKD$ and back to numbers with _CVD.
- Some useful constants are available since QB64-PE v4.0.0
-
- _SIZE_OF_DOUBLE = 8 'in bytes
- _DOUBLE_MIN# = -1.797693134862315D+308 'smallest normal number
- _DOUBLE_MAX# = 1.797693134862315D+308 'largest normal number
- _DOUBLE_MIN_FRAC# = 2.225073858507201D-308 'smallest normal number closest to zero
Availability
See also