]> www.ginac.de Git - cln.git/blobdiff - src/float/dfloat/conv/cl_I_to_double.cc
Cater to the fact that g++ 4.3 will use a different naming for
[cln.git] / src / float / dfloat / conv / cl_I_to_double.cc
index 31e7038f60293173e1aa0984943472f425d6b0fd..94cb5a50e4e9060b3d03762e90a6f1d9e13ea53f 100644 (file)
@@ -1,10 +1,10 @@
-// cl_double_approx().
+// double_approx().
 
 // General includes.
 #include "cl_sysdep.h"
 
 // Specification.
-#include "cl_integer.h"
+#include "cln/integer.h"
 
 
 // Implementation.
 #include "cl_DS.h"
 #include "cl_F.h"
 
-double cl_double_approx (const cl_I& x)
+namespace cln {
+
+double double_approx (const cl_I& x)
 {
 // Method: same as cl_I_to_DF().
       if (eq(x,0)) { return 0.0; }
       var cl_signean sign = -(cl_signean)minusp(x); // Vorzeichen
       var cl_I abs_x = (sign==0 ? x : -x);
-      var uintL exp = integer_length(abs_x); // (integer-length x)
+      var uintC exp = integer_length(abs_x); // (integer-length x)
       // NDS zu |x|>0 bilden:
       var const uintD* MSDptr;
       var uintC len;
-      I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,);
+      I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,);
       // MSDptr/len/LSDptr ist die NDS zu x, len>0.
-      // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize
+      // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize
       // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen).
       // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben.
       var uintD msd = msprefnext(MSDptr); // erstes Digit
@@ -57,15 +59,15 @@ double cl_double_approx (const cl_I& x)
       --len; ok:
       #if (cl_word_size==64)
       // Die NDS besteht aus msd, msdd und len weiteren Digits.
-      // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer
+      // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer
       // 63 + (exp mod intDsize).
       var uintL shiftcount = exp % intDsize;
-      var uint64 mant = // führende 64 Bits
+      var uint64 mant = // führende 64 Bits
         (shiftcount==0
           ? msdd
           : (((uint64)msd << (64-shiftcount)) | (msdd >> shiftcount))
         );
-      // Das höchste in mant gesetzte Bit ist Bit Nummer 63.
+      // Das höchste in mant gesetzte Bit ist Bit Nummer 63.
       if ( ((mant & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden
            || ( ((mant & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0
                 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0
@@ -97,18 +99,18 @@ double cl_double_approx (const cl_I& x)
       return u.machine_double;
       #else
       // Die NDS besteht aus msd, msdd, msddf und len weiteren Digits.
-      // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer
+      // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer
       // 63 + (exp mod intDsize).
       var uintL shiftcount = exp % intDsize;
-      var uint32 manthi; // führende 32 Bits
-      var uint32 mantlo; // nächste 32 Bits
+      var uint32 manthi; // führende 32 Bits
+      var uint32 mantlo; // nächste 32 Bits
       if (shiftcount==0)
         { manthi = msdd; mantlo = msddf; }
         else
         { manthi = ((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount);
           mantlo = (msdd << (32-shiftcount)) | (msddf >> shiftcount);
         }
-      // Das höchste in mant gesetzte Bit ist Bit Nummer 63.
+      // Das höchste in mant gesetzte Bit ist Bit Nummer 63.
       if ( ((mantlo & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden
            || ( ((mantlo & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0
                 && ((msddf & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0
@@ -147,3 +149,5 @@ double cl_double_approx (const cl_I& x)
       return u.machine_double;
       #endif
 }
+
+}  // namespace cln