]> www.ginac.de Git - cln.git/blobdiff - src/float/lfloat/elem/cl_LF_ftrunc.cc
Extend the exponent range from 32 bits to 64 bits on selected platforms.
[cln.git] / src / float / lfloat / elem / cl_LF_ftrunc.cc
index 4f45f01f31e6ba5e53468d56464f1a2c128ac262..f0f204ee1254dbcfb32f6ed9c9d136609ca66da7 100644 (file)
@@ -4,7 +4,7 @@
 #include "cl_sysdep.h"
 
 // Specification.
-#include "cl_lfloat.h"
+#include "cln/lfloat.h"
 
 
 // Implementation.
@@ -13,6 +13,8 @@
 #include "cl_LF_impl.h"
 #include "cl_DS.h"
 
+namespace cln {
+
 const cl_LF ftruncate (const cl_LF& x)
 {
 // Methode:
@@ -22,12 +24,12 @@ const cl_LF ftruncate (const cl_LF& x)
 // e>=16n -> Ergebnis x
 #if 0
       var cl_signean sign;
-      var sintL exp;
+      var sintE exp;
       var const uintD* mantMSDptr;
       var uintC mantlen;
       LF_decode(x, { return x; }, sign=,exp=,mantMSDptr=,mantlen=,);
       if (exp<=0) { return encode_LF0(mantlen); } // e<=0 -> Ergebnis 0.0
-      if ((uintL)exp >= intDsize*(uintL)mantlen) // e>=16n -> x als Ergebnis
+      if ((uintE)exp >= intDsize*mantlen) // e>=16n -> x als Ergebnis
         { return x; }
         else
         // 0 < e < 16n
@@ -35,8 +37,8 @@ const cl_LF ftruncate (const cl_LF& x)
         { CL_ALLOCA_STACK;
           var uintD* MSDptr;
           num_stack_alloc(mantlen, MSDptr=,);
-          { var uintC count = floor((uintL)exp,intDsize); // zu kopierende Digits, < mantlen
-            var uintC bitcount = ((uintL)exp) % intDsize; // zu kopierende Bits danach, >=0, <intDsize
+          { var uintC count = floor((uintE)exp,intDsize); // zu kopierende Digits, < mantlen
+            var uintC bitcount = ((uintE)exp) % intDsize; // zu kopierende Bits danach, >=0, <intDsize
             var uintD* ptr =
               copy_loop_msp(mantMSDptr,MSDptr,count); // count ganze Digits kopieren
             msprefnext(ptr) = mspref(mantMSDptr,count) & minus_bitm(intDsize-bitcount); // dann bitcount Bits kopieren
@@ -46,13 +48,13 @@ const cl_LF ftruncate (const cl_LF& x)
         }
 #else
       var uintC len = TheLfloat(x)->len;
-      var uintL uexp = TheLfloat(x)->expo;
+      var uintE uexp = TheLfloat(x)->expo;
       if (uexp <= LF_exp_mid)
         { if (uexp == 0) { return x; } // x=0.0 -> Ergebnis 0.0
           return encode_LF0(len); // e<=0 -> Ergebnis 0.0
         }
-      var uintL exp = uexp - LF_exp_mid;
-      if (exp >= intDsize*(uintL)len) // e>=16n -> x als Ergebnis
+      var uintE exp = uexp - LF_exp_mid;
+      if (exp >= intDsize*len) // e>=16n -> x als Ergebnis
         { return x; }
       // 0 < e < 16n
       var Lfloat y = allocate_lfloat(len,uexp,TheLfloat(x)->sign); // neues Long-Float
@@ -68,3 +70,5 @@ const cl_LF ftruncate (const cl_LF& x)
       return y;
 #endif
 }
+
+}  // namespace cln