double

System.Double
Double Precision Floating Point (-1.797 E 308 to 1.797 E 308)
17 significant digits.
The default value is 0.

double myDouble; 
System.Double myDouble;

Explicit Data Type

You can append literal constants with the letter "D" or "d", although this is unnecessary because all floating-point numbers default to the double data type.

double myDouble = 1.6;                            'double is the default  
double myDouble = 1.6d; 'Suffix is optional
double myDouble = 1.6D; 'Suffix is optional

Converting

// Double To Integer 
double myDouble = 1.6;
int myInteger = (int)myDouble;

// Double To Decimal
double myDouble = 1.6;
int myDecimal = (decimal)myDouble;

// Double To Float
double myDouble = 1.6;
float myFloat = (float)myDouble;

Examples

double myDouble = 4/3;                            '=1.33333337  

double myDouble = 3.14E3; 'Scientific notation
System.Diagnostics.Debug.Print myDouble '= 3140

double myDouble = -1.0/0.0; 'Negative infinity
System.Diagnostics.Debug.Print myDouble '= -Infinity

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext