[fpc-devel] Abs(Variant) unexpected result
Bart
bartjunk64 at gmail.com
Sun Feb 25 12:23:41 CET 2018
Hi,
See: http://forum.lazarus.freepascal.org/index.php/topic,40223.msg277657/
This seems rather unexpected.
Is it a bug?
program v;
{$ifdef windows}
{$apptype console}
{$endif}
uses
variants;
var
X: Variant;
B: Boolean;
begin
X := -1.5;
writeln('X = ',X);
B := VarIsFloat(X);
writeln('VarIsFloat : ',B);
B := VarIsNumeric(X);
writeln('VarIsNumeric: ',B);
B := VarIsOrdinal(X);
writeln('VarIsOrdinal: ',B);
X := Abs(X);
writeln('After Abs()');
writeln('X = ',X);
B := VarIsFloat(X);
writeln('VarIsFloat : ',B);
B := VarIsNumeric(X);
writeln('VarIsNumeric: ',B);
B := VarIsOrdinal(X);
writeln('VarIsOrdinal: ',B);
end.
Outputs:
C:\Users\Bart\LazarusProjecten\bugs\Console\variants>v
X = -1,5
VarIsFloat : TRUE
VarIsNumeric: TRUE
VarIsOrdinal: FALSE
After Abs()
X = 2
VarIsFloat : FALSE
VarIsNumeric: TRUE
VarIsOrdinal: TRUE
Bart
More information about the fpc-devel
mailing list