]> www.ginac.de Git - cln.git/blobdiff - src/float/lfloat/elem/cl_LF_scale.cc
Extend the exponent range from 32 bits to 64 bits on selected platforms.
[cln.git] / src / float / lfloat / elem / cl_LF_scale.cc
index bcbb51943557dc19f7568c2445b05cab90b717b2..7a2738f2b19b68152f9c2e908dbdaf7a98223fff 100644 (file)
@@ -15,7 +15,7 @@
 
 namespace cln {
 
-const cl_LF scale_float (const cl_LF& x, sintL delta)
+const cl_LF scale_float (const cl_LF& x, sintC delta)
 {
   // Methode:
   // delta=0 -> x als Ergebnis
@@ -23,9 +23,9 @@ const cl_LF scale_float (const cl_LF& x, sintL delta)
   // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein.
   // Neues LF mit um delta vergrößertem Exponenten bilden.
       if (delta == 0) { return x; } // delta=0 -> x als Ergebnis
-      var uintL uexp = TheLfloat(x)->expo;
+      var uintE uexp = TheLfloat(x)->expo;
       if (uexp==0) { return x; }
-      var uintL udelta = delta;
+      var uintE udelta = delta;
       if (delta >= 0) {
         // udelta = delta >=0
        if (   ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf?
@@ -33,8 +33,8 @@ const cl_LF scale_float (const cl_LF& x, sintL delta)
           )
          { cl_error_floating_point_overflow(); }
       } else {
-        // delta <0, udelta = 2^32+delta
-       if (   ((uexp = uexp+udelta) >= udelta) // oder Exponent-Unterlauf?
+        // delta <0, udelta = 2^intEsize+delta
+       if (   ((uintE)(-(uexp = uexp+udelta)) <= (uintE)(-udelta)) // oder Exponent-Unterlauf?
            || (uexp < LF_exp_low) // oder Exponent zu klein?
           )
          { cl_error_floating_point_underflow(); }