]> www.ginac.de Git - cln.git/blobdiff - src/float/lfloat/elem/cl_LF_1plus.cc
Extend the exponent range from 32 bits to 64 bits on selected platforms.
[cln.git] / src / float / lfloat / elem / cl_LF_1plus.cc
index 877fb2d8d7f0daf0c852abedd93e1512b0b6c617..2114521667b8a52ca05544f08f6a8d370575925b 100644 (file)
@@ -14,6 +14,8 @@
 #include "cl_F.h"
 #include "cl_xmacros.h"
 
+namespace cln {
+
 const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
 {
 // Methode (nach [Knuth, II, Seminumerical Algorithms, Abschnitt 4.2.1., S.200]):
@@ -33,15 +35,15 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
 // Normalisiere, fertig.
       var cl_LF x1 = arg1;
       var cl_LF x2 = arg2;
-      var uintL uexp1 = TheLfloat(arg1)->expo;
-      var uintL uexp2 = TheLfloat(arg2)->expo;
+      var uintE uexp1 = TheLfloat(arg1)->expo;
+      var uintE uexp2 = TheLfloat(arg2)->expo;
       if (uexp1 < uexp2)
         // x1 und x2 vertauschen
-        { x1 = arg2; x2 = arg1; swap(uintL, uexp1,uexp2); }
+        { x1 = arg2; x2 = arg1; swap(uintE, uexp1,uexp2); }
       // uexp1 >= uexp2
       if (uexp2==0) { return x1; } // x2=0.0 -> x1 als Ergebnis
       var uintC len = TheLfloat(x1)->len; // Länge n von x1 und x2
-      var uintL expdiff = uexp1-uexp2; // e1-e2
+      var uintE expdiff = uexp1-uexp2; // e1-e2
       if ((expdiff == 0) && (TheLfloat(x1)->sign != TheLfloat(x2)->sign))
         // verschiedene Vorzeichen, aber gleicher Exponent
         { // Vorzeichen des Ergebnisses festlegen:
@@ -52,10 +54,10 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
           if (erg<0) // |x1| < |x2|
             // x1 und x2 vertauschen, expdiff bleibt =0
             { x1.pointer = arg2.pointer; x2.pointer = arg1.pointer;
-              swap(uintL, uexp1,uexp2);
+              swap(uintE, uexp1,uexp2);
             }
         }
-      if (expdiff >= intDsize * (uintL)len + 2) // e1-e2 >= 16n+2 ?
+      if (expdiff >= intDsize * len + 2) // e1-e2 >= 16n+2 ?
         { return x1; } // ja -> x1 als Ergebnis
       // neues Long-Float allozieren:
       var Lfloat y = allocate_lfloat(len,uexp1,TheLfloat(x1)->sign);
@@ -151,7 +153,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
            }
            // UDS y_mantMSDptr/len/y_mantLSDptr/rounding_bits normalisieren:
            {var uintD* ptr = y_mantMSDptr;
-            var uintL k = 0;
+            var uintC k = 0;
             var uintC count;
             dotimesC(count,len,
               { if (!(mspref(ptr,0)==0)) goto nonzero_found;
@@ -170,7 +172,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
                 rounding_bits = 0; // und keine weiteren Rundungsbits
                 // Exponenten um intDsize*k erniedrigen:
                 k = intDsize*k;
-               {var uintL uexp = TheLfloat(y)->expo;
+               {var uintE uexp = TheLfloat(y)->expo;
                 #if !(LF_exp_low==1)
                 if (uexp < k+LF_exp_low)
                 #else
@@ -203,7 +205,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
                     rounding_bits = 0; // = rounding_bits << s;
                   }
                 // Exponenten um s erniedrigen:
-               {var uintL uexp = TheLfloat(y)->expo;
+               {var uintE uexp = TheLfloat(y)->expo;
                 #if !(LF_exp_low==1)
                 if (uexp < s+LF_exp_low)
                 #else
@@ -238,3 +240,5 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2)
       // y fertig.
       return y;
 }
+
+}  // namespace cln