## Double

### From Xojo Documentation

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Data Type

A Double is an intrinsic data type. A Double is a number that can contain a decimal value, i.e., a real number. In other languages, a Double may be referred to as a double precision floating point number. Because Doubles are numbers, you can perform mathematical calculations on them. Doubles use 8 bytes of memory. The default value of a Double is 0.0.

Methods
 Equals ToText
 Shared Methods

## Notes

Double is an IEEE double-precision, floating-point value. This means it is speedy but has some limits for values it can contain. For more information, refer to the wikipedia page about floating point.

In most situations you should use Currency when dealing with monetary values.

The VarType function returns a value of 5 when passed a Double.

### Numerical limits

• The maximum value of a Double is: ±1.79769313486231570814527423731704357e+308
• The minimum value towards zero is: ±4.94065645841246544176568792868221372e-324

### NaN and Infinity

Doubles can hold some special values described below:

• NaN (i.e. "Not a Number"): occurs if you attempted to perform an illegal mathematical operation, like getting the square root of a negative number. Any further calculation made with a NaN will lead to a NaN value. Str or Format methods return a string beginning with "NaN", e.g. "NaN(021)".
• Infinity: some calculations lead to an infinite result (positive or negative), e.g. Log( 0 ), or you may exceed the maximum value which can be hold. In such a case, a double will be set to a special value, whose Str will return "INF" (for INFinity) or "-INF" (negative INFinity). Any further calculation will lead to a NaN or infinity value.

## Sample Code

The Double data type allows you to store and manage floating point numbers.

Dim d As Double
d = 3.141592653