Browse Source

* rem_pio2: Return NaN for infinite or NaN arguments, so it is propagated into return values of sin(),cos() and other (not yet existing) callers.

git-svn-id: trunk@27625 -
sergei 11 years ago
parent
commit
65f75791ea
1 changed files with 6 additions and 0 deletions
  1. 6 0
      rtl/inc/genmath.inc

+ 6 - 0
rtl/inc/genmath.inc

@@ -951,6 +951,12 @@ type
       end;
       z := abs(x);
       e0 := (float64high(z) shr 20)-1046;
+      if (e0 = ($7ff-1046)) then  { z is Inf or NaN }
+      begin
+        z := x - x;
+        result:=0;
+        exit;
+      end;
       float64sethigh(z,float64high(z) - (e0 shl 20));
       tx[0] := trunc(z);
       z := (z-tx[0])*two24;