]> www.ginac.de Git - cln.git/blobdiff - src/float/lfloat/elem/cl_LF_square.cc
Extend the exponent range from 32 bits to 64 bits on selected platforms.
[cln.git] / src / float / lfloat / elem / cl_LF_square.cc
index 59c38915f2d66a11b4e5e490d784e7ba6d0f35d5..72d582741f0ffd49a0365352998e5377ca5527b8 100644 (file)
@@ -4,7 +4,7 @@
 #include "cl_sysdep.h"
 
 // Specification.
-#include "cl_lfloat.h"
+#include "cln/lfloat.h"
 
 
 // Implementation.
 #include "cl_DS.h"
 #include "cl_F.h"
 
+namespace cln {
+
 const cl_LF square (const cl_LF& x)
 {
 // Methode: wie operator*(x,x).
       var uintC len = TheLfloat(x)->len;
-      var uintL uexp = TheLfloat(x)->expo;
+      var uintE uexp = TheLfloat(x)->expo;
       if (uexp==0) // x=0.0 -> Ergebnis 0.0
         { return x; }
       // Exponenten addieren:
       // (uexp-LF_exp_mid) + (uexp-LF_exp_mid) = (2*uexp-LF_exp_mid)-LF_exp_mid
-      if ((sintL)uexp >= 0)
+      if ((sintE)uexp >= 0)
         // kein Carry
         { uexp = 2*uexp;
           if (uexp < LF_exp_mid+LF_exp_low)
@@ -35,7 +37,7 @@ const cl_LF square (const cl_LF& x)
         else
         // Carry
         { uexp = 2*uexp;
-          if (uexp > (uintL)(LF_exp_mid+LF_exp_high+1)) { cl_error_floating_point_overflow(); }
+          if (uexp > (uintE)(LF_exp_mid+LF_exp_high+1)) { cl_error_floating_point_overflow(); }
         }
       uexp = uexp - LF_exp_mid;
       // Nun ist LF_exp_low <= uexp <= LF_exp_high+1.
@@ -87,3 +89,4 @@ const cl_LF square (const cl_LF& x)
 }
 // Bit complexity (N = length(x)): O(M(N)).
 
+}  // namespace cln