]> www.ginac.de Git - cln.git/blobdiff - src/float/ffloat/conv/cl_RA_to_float.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / float / ffloat / conv / cl_RA_to_float.cc
index 877f82489772a4da61dd809652667095fbf02de2..1e38f8ffae004ead1380c2c3165db5cc2618782a 100644 (file)
@@ -1,26 +1,28 @@
-// cl_float_approx().
+// float_approx().
 
 // General includes.
-#include "cl_sysdep.h"
+#include "base/cl_sysdep.h"
 
 // Specification.
-#include "cl_rational.h"
+#include "cln/rational.h"
 
 
 // Implementation.
 
-#include "cl_FF.h"
-#include "cl_RA.h"
-#include "cl_integer.h"
-#include "cl_I.h"
-#include "cl_F.h"
+#include "float/ffloat/cl_FF.h"
+#include "rational/cl_RA.h"
+#include "cln/integer.h"
+#include "integer/cl_I.h"
+#include "float/cl_F.h"
 
-float cl_float_approx (const cl_RA& x)
+namespace cln {
+
+float float_approx (const cl_RA& x)
 {
 // Method: same as cl_RA_to_FF().
       if (integerp(x)) {
         DeclareType(cl_I,x);
-        return cl_float_approx(x);
+        return float_approx(x);
       }
  {    // x Ratio
       DeclareType(cl_RT,x);
@@ -29,8 +31,8 @@ float cl_float_approx (const cl_RA& x)
       var const cl_I& b = denominator(x); // b
       var cl_signean sign = -(cl_signean)minusp(a); // Vorzeichen
       if (!(sign==0)) { a = -a; } // Betrag nehmen, liefert a
-      var sintL lendiff = (sintL)integer_length(a) // (integer-length a)
-                          - (sintL)integer_length(b); // (integer-length b)
+      var sintC lendiff = (sintC)integer_length(a) // (integer-length a)
+                          - (sintC)integer_length(b); // (integer-length b)
       if (lendiff > FF_exp_high-FF_exp_mid) // Exponent >= n-m > Obergrenze ?
         { u.eksplicit = make_FF_word(sign,bit(FF_exp_len)-1,0); // Infinity
           return u.machine_float;
@@ -50,13 +52,13 @@ float cl_float_approx (const cl_RA& x)
         { zaehler = ash(a,(FF_mant_len+2) - lendiff); // (ash a -n+m+25)
           nenner = b; // b
         }
-      // Division zaehler/nenner durchführen:
+      // Division zaehler/nenner durchführen:
       var cl_I_div_t q_r = cl_divide(zaehler,nenner);
       var cl_I& q = q_r.quotient;
       var cl_I& r = q_r.remainder;
       // 2^24 <= q < 2^26, also ist q Fixnum oder Bignum mit bn_minlength Digits.
       var uint32 mant = ((FF_mant_len+3 < cl_value_len)
-                          ? FN_to_UL(q)
+                          ? FN_to_UV(q)
                           : cl_I_to_UL(q)
                         );
       if (mant >= bit(FF_mant_len+2))
@@ -102,3 +104,5 @@ float cl_float_approx (const cl_RA& x)
         { u.eksplicit = make_FF_word(sign,lendiff+FF_exp_mid,mant); }
       return u.machine_float;
 }}
+
+}  // namespace cln