Browse Source

+ added pi bit pattern to the compiler, so pi should always be correct

florian 20 years ago
parent
commit
cc9534cf41
3 changed files with 27 additions and 12 deletions
  1. 7 1
      compiler/globals.pas
  2. 5 1
      compiler/globtype.pas
  3. 15 10
      compiler/ninl.pas

+ 7 - 1
compiler/globals.pas

@@ -82,10 +82,13 @@ interface
        MathQNaN : tdoublearray = (0,0,252,255,0,0,0,0);
        MathInf : tdoublearray = (0,0,240,127,0,0,0,0);
        MathNegInf : tdoublearray = (0,0,240,255,0,0,0,0);
+       MathPi : tdoublearray =  (251,33,9,64,24,45,68,84);
 {$else}
        MathQNaN : tdoublearray = (0,0,0,0,0,0,252,255);
        MathInf : tdoublearray = (0,0,0,0,0,0,240,127);
        MathNegInf : tdoublearray = (0,0,0,0,0,0,240,255);
+       MathPi : tdoublearray =  (24,45,68,84,251,33,9,64);
+       MathPiExtended : textendedarray = (53,194,104,33,162,218,15,201,0,64);
 {$endif}
 
     type
@@ -2180,7 +2183,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.161  2005-01-20 16:38:45  peter
+  Revision 1.162  2005-01-23 21:09:11  florian
+    + added pi bit pattern to the compiler, so pi should always be correct
+
+  Revision 1.161  2005/01/20 16:38:45  peter
     * load jmp_buf_size from system unit
 
   Revision 1.160  2005/01/09 20:24:43  olle

+ 5 - 1
compiler/globtype.pas

@@ -75,6 +75,7 @@ than 255 characters. That's why using Ansi Strings}
        TConstPtrUInt = AWord;
 
        tdoublearray = array[0..7] of byte;
+       textendedarray = array[0..9] of byte;
 
        { Switches which can be changed locally }
        tlocalswitch = (cs_localnone,
@@ -318,7 +319,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.67  2005-01-04 16:20:51  florian
+  Revision 1.68  2005-01-23 21:09:12  florian
+    + added pi bit pattern to the compiler, so pi should always be correct
+
+  Revision 1.67  2005/01/04 16:20:51  florian
     * fixed nan et al. handling on arm
 
   Revision 1.66  2004/12/27 16:35:48  peter

+ 15 - 10
compiler/ninl.pas

@@ -1210,14 +1210,7 @@ implementation
           begin
             { no parameters? }
             if not assigned(left) then
-             begin
-               case inlinenumber of
-                 in_pi_real :
-                   hp:=crealconstnode.create(pi,pbestrealtype^);
-                 else
-                   internalerror(89);
-               end;
-             end
+              internalerror(200501231)
             else
              begin
                vl:=0;
@@ -2351,7 +2344,16 @@ implementation
 
      function tinlinenode.first_pi : tnode;
       begin
-        result := crealconstnode.create(pi,pbestrealtype^);
+      {$ifdef x86}
+        { x86 has pi in hardware }
+        result:=crealconstnode.create(pi,pbestrealtype^);
+      {$else x86}
+        {$ifdef cpuextended}
+          result:=crealconstnode.create(extended(MathPiExtended),pbestrealtype^);
+        {$else cpuextended}
+          result:=crealconstnode.create(double(MathPi),pbestrealtype^);
+        {$endif cpuextended}
+      {$endif x86}
       end;
 
 
@@ -2463,7 +2465,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.156  2004-12-05 12:28:11  peter
+  Revision 1.157  2005-01-23 21:09:12  florian
+    + added pi bit pattern to the compiler, so pi should always be correct
+
+  Revision 1.156  2004/12/05 12:28:11  peter
     * procvar handling for tp procvar mode fixed
     * proc to procvar moved from addrnode to typeconvnode
     * inlininginfo is now allocated only for inline routines that