mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 16:09:17 +02:00
* correctly compare floating point values in TValue
git-svn-id: trunk@41535 -
This commit is contained in:
parent
2b9c7c7c78
commit
c2da9abd17
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user