Difference between revisions of "FLOAT"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>SMcNeill
(style guidelines)
 
Line 4: Line 4:
  
 
{{PageSyntax}}  
 
{{PageSyntax}}  
::[[DIM]] {{Parameter|variable}} AS '''_FLOAT'''
+
::[[DIM]] {{Parameter|variable}} AS [[_FLOAT]]
  
  
 
{{PageDescription}}
 
{{PageDescription}}
 
* '''QB64''' always allocates 32 bytes to store this value.  
 
* '''QB64''' always allocates 32 bytes to store this value.  
* It is safe to assume this value is at least as precise as {{KW|DOUBLE}}.  
+
* It is safe to assume this value is at least as precise as [[DOUBLE]].  
 
* Under the current implementation it is stored in a 10-byte floating point variable.
 
* Under the current implementation it is stored in a 10-byte floating point variable.
* '''_FLOAT''' variables can also use the ## variable name type suffix.
+
* [[_FLOAT]] variables can also use the ## variable name type suffix.
 
* Values returned may be expressed using exponential or [[scientific notation]] using '''E''' for SINGLE or '''D''' for DOUBLE precision.
 
* Values returned may be expressed using exponential or [[scientific notation]] using '''E''' for SINGLE or '''D''' for DOUBLE precision.
* According to [http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html IEEE-754] this can store a value of up to 1.1897E+4932 compared to a DOUBLE which 'only' goes up to 1.7976E+308.  
+
* According to [http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html IEEE-754] this can store a value of up to 1.1897E+4932 compared to a DOUBLE which goes up to 1.7976E+308.  
* Floating decimal point numerical values cannot be {{KW|_UNSIGNED}}!
+
* Floating decimal point numerical values cannot be [[_UNSIGNED]].
 
* Values can be converted to 32 byte [[ASCII]] strings using [[_MK$]] and back with [[_CV]].
 
* Values can be converted to 32 byte [[ASCII]] strings using [[_MK$]] and back with [[_CV]].
 
* '''When a variable has not been assigned or has no type suffix, the value defaults to [[SINGLE]].'''
 
* '''When a variable has not been assigned or has no type suffix, the value defaults to [[SINGLE]].'''
* Note: A _GL_FLOAT is a [[SINGLE]] (4 byte) floating point number, a QB64 _FLOAT is a 10-byte floating point number.
+
* Note: OpenGL's [[_GL_FLOAT]] constant is a [[SINGLE]] (4 byte) floating point number, while a native QB64 _FLOAT is a 10-byte floating point number.
  
  
Line 24: Line 24:
 
* [[_MK$]], [[_CV]]
 
* [[_MK$]], [[_CV]]
 
* [[_DEFINE]], [[DIM]]
 
* [[_DEFINE]], [[DIM]]
* [[PDS(7.1) Procedures#CURRENCY|CURRENCY]]
+
* [[PDS (7.1) Procedures#CURRENCY|CURRENCY]]
 
* [[Variable Types]]
 
* [[Variable Types]]
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Latest revision as of 23:54, 5 September 2017

_FLOAT numerical values offer the maximum floating-point decimal precision available using QB64.


Syntax

DIM variable AS _FLOAT


Description

  • QB64 always allocates 32 bytes to store this value.
  • It is safe to assume this value is at least as precise as DOUBLE.
  • Under the current implementation it is stored in a 10-byte floating point variable.
  • _FLOAT variables can also use the ## variable name type suffix.
  • Values returned may be expressed using exponential or scientific notation using E for SINGLE or D for DOUBLE precision.
  • According to IEEE-754 this can store a value of up to 1.1897E+4932 compared to a DOUBLE which goes up to 1.7976E+308.
  • Floating decimal point numerical values cannot be _UNSIGNED.
  • Values can be converted to 32 byte ASCII strings using _MK$ and back with _CV.
  • When a variable has not been assigned or has no type suffix, the value defaults to SINGLE.
  • Note: OpenGL's _GL_FLOAT constant is a SINGLE (4 byte) floating point number, while a native QB64 _FLOAT is a 10-byte floating point number.


See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page