Skip to main content

varDouble

varDouble = 5

Example

function HasDoubleStorage(const Value: Variant): Boolean;
begin
Result := (VarType(Value) and varTypeMask) = varDouble;
end;

Usage

varDouble identifies a 64-bit binary floating-point Variant, including finite values, signed zero, infinities and NaN.

Additional Technical Info

varDouble is the base TVarType code $0005 for a 64-bit IEEE-style binary floating-point payload. It offers roughly 15-17 significant decimal digits but cannot exactly represent most decimal fractions.

The type can also carry signed zero, positive/negative infinity and NaN. Those values have special comparison and conversion behavior: NaN is not an ordinary ordered number, infinities can overflow narrower targets and signed zero can be lost in text or business comparisons.

Delphi's PackVarCreation setting means an apparently floating value can instead be tagged varSingle, varCurrency or an integer type depending on how it was created. Exact tag equality is therefore a representation test, not a general numeric predicate.

Integration guidance

  • Do not use Double for exact money or identifiers. Use varCurrency, integer scaling or a governed decimal/text representation.
  • Validate finite/range requirements before writing databases, JSON, XML or partner formats that cannot represent NaN/infinity.
  • Converting a large varInt64 to Double can lose low-order integer bits even when it remains in range.
  • VarAsType may round or raise on invalid/overflowing input.

VarType itself performs no conversion. Mask away flags for base classification.

The example is source-reviewed only; no floating-point operation was executed.

External references

Created 2026-07-15