* correctly compare floating point values in TValue

git-svn-id: trunk@41535 -
This commit is contained in:
svenbarth 2019-03-01 15:20:56 +00:00
parent 2b9c7c7c78
commit c2da9abd17

View File

@ -37,7 +37,7 @@ function GetArray(const aArg: array of SizeInt): TValue;
implementation implementation
uses uses
TypInfo, SysUtils; TypInfo, SysUtils, Math;
{$ifndef fpc} {$ifndef fpc}
function TValueHelper.AsUnicodeString: UnicodeString; function TValueHelper.AsUnicodeString: UnicodeString;
@ -124,10 +124,12 @@ begin
Result := False Result := False
else begin else begin
case td1^.FloatType of case td1^.FloatType of
ftSingle, ftSingle:
ftDouble, Result := SameValue(Single(aValue1.AsExtended), Single(aValue2.AsExtended));
ftDouble:
Result := SameValue(Double(aValue1.AsExtended), Double(aValue2.AsExtended));
ftExtended: ftExtended:
Result := aValue1.AsExtended = aValue2.AsExtended; Result := SameValue(aValue1.AsExtended, aValue2.AsExtended);
ftComp: ftComp:
Result := aValue1.AsInt64 = aValue2.AsInt64; Result := aValue1.AsInt64 = aValue2.AsInt64;
ftCurr: ftCurr: