Prechádzať zdrojové kódy

* Fix isNan, isInfinity, IsPositiveInfinity

git-svn-id: trunk@35356 -
michael 8 rokov pred
rodič
commit
8d7fd39282
1 zmenil súbory, kde vykonal 8 pridanie a 8 odobranie
  1. 8 8
      rtl/objpas/sysutils/syshelpf.inc

+ 8 - 8
rtl/objpas/sysutils/syshelpf.inc

@@ -1,25 +1,25 @@
 Class Function TFLOATHELPER.IsNan(const AValue: FLOATTYPE): Boolean; overload; inline; static;
 
 begin
-  Result:=AValue=Nan;
+  Result:=TFloatRec(AValue).SpecialType=fsNan;
 end;
 
 Class Function TFLOATHELPER.IsInfinity(const AValue: FLOATTYPE): Boolean; overload; inline; static;
 
 begin
-  Result:=(AValue=PositiveInfinity) or (AValue=NegativeInfinity);
+  Result:=TFloatRec(AValue).SpecialType in [fsInf,fsNinf];
 end;
 
 Class Function TFLOATHELPER.IsNegativeInfinity(const AValue: FLOATTYPE): Boolean; overload; inline; static;
 
 begin
-  Result:=AValue=NegativeInfinity;
+  Result:=TFloatRec(AValue).SpecialType=fsNinf;
 end;
 
 Class Function TFLOATHELPER.IsPositiveInfinity(const AValue: FLOATTYPE): Boolean; overload; inline; static;
 
 begin
-  Result:=(AValue=PositiveInfinity);
+  Result:=TFloatRec(AValue).SpecialType=fsInf;
 end;
 
 Class Function TFLOATHELPER.Parse(const AString: string): FLOATTYPE; overload; inline; static;
@@ -180,25 +180,25 @@ end;
 Function TFLOATHELPER.IsInfinity: Boolean; overload; inline;
 
 begin
-  Result:=(Self=PositiveInfinity) or (Self=NegativeInfinity);
+  Result:=TFloatRec(Self).SpecialType in [fsInf,fsNinf];
 end;
 
 Function TFLOATHELPER.IsNan: Boolean; overload; inline;
 
 begin
-  Result:=(Self=Nan);
+  Result:=TFloatRec(Self).SpecialType=fsNan;
 end;
 
 Function TFLOATHELPER.IsNegativeInfinity: Boolean; overload; inline;
 
 begin
-  Result:=(Self=NegativeInfinity);
+  Result:=TFloatRec(Self).SpecialType=fsNinf;
 end;
 
 Function TFLOATHELPER.IsPositiveInfinity: Boolean; overload; inline;
 
 begin
-  Result:=(Self=PositiveInfinity);
+  Result:=TFloatRec(Self).SpecialType=fsInf;
 end;
 
 Function TFLOATHELPER.Mantissa: QWord;