Difference between revisions of "CDBL"

From QB64 Wiki
Jump to navigation Jump to search
imported>SMcNeill
(style guidelines)
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Purpose:'''
+
[[CDBL]] converts a value to the closest [[DOUBLE]]-precision value.
To convert x to a double-precision number.
 
  
'''Syntax:'''
 
CDBL(x)
 
  
'''Comments:'''
 
x must be a numeric expression.
 
  
'''Example:'''
+
{{PageSyntax}}
A=454.67
+
: {{Parameter|doubleValue#}} = [[CDBL]]({{Parameter|expression}})
PRINT A; CDBL(A)
 
 
454.67 454.6700134277344
 
Prints a double-precision version of the single-precision value stored in the variable named A.
 
  
The last 11 numbers in the double-precision number have no meaning in this example, since A was previously defined to only two-decimal place accuracy.
 
  
Note
+
{{Parameters}}
 +
* {{Parameter|expression}} is any [[TYPE]] of literal or variable numerical value or mathematical calculation.
  
See the CINT and CSNG functions for converting numbers to integer and single precision, respectively.
+
 
 +
{{PageDescription}}
 +
* Rounds to the closest [[DOUBLE]] floating decimal point value.
 +
* Also can be used to define a value as [[DOUBLE]]-precision up to 15 decimals.
 +
 
 +
 
 +
{{PageExamples}}
 +
''Example:'' Prints a double-precision version of the single-precision value stored in the variable named A.
 +
{{CodeStart}}
 +
A = 454.67
 +
{{Cl|PRINT}} A; {{Cl|CDBL}}(A)
 +
{{CodeEnd}}
 +
{{OutputStart}} 454.67 454.6700134277344
 +
{{OutputEnd}}
 +
: The last 11 numbers in the double-precision number change the value in this example, since A was previously defined to only two-decimal place accuracy.
 +
 
 +
 
 +
{{PageSeeAlso}}
 +
* [[CINT]], [[CLNG]]
 +
* [[CSNG]], [[_ROUND]]
 +
 
 +
 
 +
{{PageNavigation}}

Revision as of 11:10, 10 September 2017

CDBL converts a value to the closest DOUBLE-precision value.


Syntax

doubleValue# = CDBL(expression)


Parameters

  • expression is any TYPE of literal or variable numerical value or mathematical calculation.


Description

  • Rounds to the closest DOUBLE floating decimal point value.
  • Also can be used to define a value as DOUBLE-precision up to 15 decimals.


Examples

Example: Prints a double-precision version of the single-precision value stored in the variable named A.

A = 454.67 PRINT A; CDBL(A)

454.67 454.6700134277344

The last 11 numbers in the double-precision number change the value in this example, since A was previously defined to only two-decimal place accuracy.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page