uses
SysUtils, Variants;
var
VariantSingle: Variant;
VTSingle: TVarType;
SingleTest: Single;
VariantDouble: Variant;
DoubleTest: Double;
VTDouble: TVarType;
begin
SingleTest := 1.234;
VariantSingle := SingleTest;
VTSingle := VarType(VariantSingle) and varTypeMask;
DoubleTest := 1.23456;
VariantDouble := DoubleTest;
VTDouble := VarType(VariantDouble) and varTypeMask;
WriteLn(Format('VarType: Single: %d, Double %d', [VTSingle, VTDouble]));
end.
The code above will output:
VarType: Single: 5, Double 5
From System.pas
varSingle = $0004; { vt_r4 4 }
varDouble = $0005; { vt_r8 5 }
Thus, I'd expect VTSingle to be 4 - not 5
What am I missing?