浏览代码

* fixed exp() for hardfloat on arm.

git-svn-id: trunk@8013 -
yury 18 年之前
父节点
当前提交
04b640880c
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      rtl/inc/genmath.inc

+ 18 - 0
rtl/inc/genmath.inc

@@ -753,7 +753,11 @@ invalid:
         hi:=0.0;
         hi:=0.0;
         lo:=0.0;
         lo:=0.0;
         k:=0;
         k:=0;
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+        hx:=float64(d).low;
+{$else}
         hx:=float64(d).high;
         hx:=float64(d).high;
+{$endif FPC_DOUBLE_HILO_SWAPPED}
         xsb := (hx shr 31) and 1;               { sign bit of d }
         xsb := (hx shr 31) and 1;               { sign bit of d }
         hx := hx and $7fffffff;                 { high word of |d| }
         hx := hx and $7fffffff;                 { high word of |d| }
 
 
@@ -762,7 +766,11 @@ invalid:
           begin                  { if |d|>=709.78... }
           begin                  { if |d|>=709.78... }
             if hx >= $7ff00000 then
             if hx >= $7ff00000 then
               begin
               begin
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+                lx:=float64(d).high;
+{$else}
                 lx:=float64(d).low;
                 lx:=float64(d).low;
+{$endif FPC_DOUBLE_HILO_SWAPPED}
                 if ((hx and $fffff) or lx)<>0 then
                 if ((hx and $fffff) or lx)<>0 then
                   begin
                   begin
                     result:=d+d; { NaN }
                     result:=d+d; { NaN }
@@ -829,14 +837,24 @@ invalid:
 
 
         if k >= -1021 then
         if k >= -1021 then
           begin
           begin
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+            hy:=float64(y).low;
+            float64(y).low:=longint(hy)+(k shl 20);        { add k to y's exponent }
+{$else}
             hy:=float64(y).high;
             hy:=float64(y).high;
             float64(y).high:=longint(hy)+(k shl 20);        { add k to y's exponent }
             float64(y).high:=longint(hy)+(k shl 20);        { add k to y's exponent }
+{$endif FPC_DOUBLE_HILO_SWAPPED}
             result:=y;
             result:=y;
           end
           end
         else
         else
           begin
           begin
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+            hy:=float64(y).low;
+            float64(y).low:=longint(hy)+((k+1000) shl 20); { add k to y's exponent }
+{$else}
             hy:=float64(y).high;
             hy:=float64(y).high;
             float64(y).high:=longint(hy)+((k+1000) shl 20); { add k to y's exponent }
             float64(y).high:=longint(hy)+((k+1000) shl 20); { add k to y's exponent }
+{$endif FPC_DOUBLE_HILO_SWAPPED}
             result:=y*twom1000;
             result:=y*twom1000;
           end;
           end;
       end;
       end;