]> www.ginac.de Git - cln.git/blobdiff - src/float/transcendental/cl_F_lnx.cc
Fix linking problems on some platforms caused by inline/non-inline versions
[cln.git] / src / float / transcendental / cl_F_lnx.cc
index 73af9308c96ee51e39bc08efa23142a3b599add4..ffa178027dc87ff67ad44d2c8b716c77537b07f2 100644 (file)
@@ -16,8 +16,7 @@
 #include "cl_LF.h"
 #include "cln/integer.h"
 
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
 #include "cl_LF_zerop.cc"
 #include "cl_LF_minusp.cc"
 #include "cl_LF_exponent.cc"
@@ -45,27 +44,27 @@ namespace cln {
 const cl_LF lnx_naive (const cl_LF& x)
 {
        var cl_LF y = x-cl_float(1,x);
-       if (zerop(y)) // y=0.0 -> y als Ergebnis
+       if (zerop_inline(y)) // y=0.0 -> y als Ergebnis
                return y;
-       var uintL actuallen = TheLfloat(x)->len;
+       var uintC actuallen = TheLfloat(x)->len;
        var uintC d = float_digits(x);
-       var sintL e = float_exponent(y);
+       var sintE e = float_exponent_inline(y);
        if (e <= -(sintC)d) // e <= -d ?
                return y; // ja -> y als Ergebnis
  {     Mutable(cl_LF,x);
-       var uintL k = 0; // Rekursionszähler k:=0
+       var uintL k = 0; // Rekursionszähler k:=0
        // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe
        // angewandt werden.
-       // Wähle für ln(1+y), naive1: limit_slope = 1.0,
-       //       für ln(1+y), naive2: limit_slope = 11/16 = 0.7,
-       //       für atanh(z), naive1: limit_slope = 0.6,
-       //       für atanh(z), naive1: limit_slope = 0.5.
-       var sintL e_limit = -1-floor(isqrt(d),2); // -1-floor(sqrt(d))
+       // Wähle für ln(1+y), naive1: limit_slope = 1.0,
+       //       für ln(1+y), naive2: limit_slope = 11/16 = 0.7,
+       //       für atanh(z), naive1: limit_slope = 0.6,
+       //       für atanh(z), naive1: limit_slope = 0.5.
+       var sintL e_limit = -1-floor(isqrtC(d),2); // -1-floor(sqrt(d))
        while (e > e_limit) {
-               // e > -1-floor(sqrt(d)) -> muß |y| verkleinern.
+               // e > -1-floor(sqrt(d)) -> muß |y| verkleinern.
                x = sqrt(x); // x := (sqrt x)
                y = x-cl_float(1,x); // y := (- x 1) und
-               e = float_exponent(y); // e neu berechnen
+               e = float_exponent_inline(y); // e neu berechnen
                k = k+1; // k:=k+1
        }
        if (0) {
@@ -147,15 +146,15 @@ const cl_F lnx_naive (const cl_F& x)
        if (zerop(y)) // y=0.0 -> y als Ergebnis
                return y;
        var uintC d = float_digits(x);
-       var sintL e = float_exponent(y);
+       var sintE e = float_exponent(y);
        if (e <= -(sintC)d) // e <= -d ?
                return y; // ja -> y als Ergebnis
  {     Mutable(cl_F,x);
-       var uintL k = 0; // Rekursionszähler k:=0
+       var uintL k = 0; // Rekursionszähler k:=0
        // Bei e <= -1-floor(sqrt(d)) kann die Potenzreihe angewandt werden.
-       var sintL e_limit = -1-isqrt(d); // -1-floor(sqrt(d))
+       var sintL e_limit = -1-isqrtC(d); // -1-floor(sqrt(d))
        while (e > e_limit) {
-               // e > -1-floor(sqrt(d)) -> muß |y| verkleinern.
+               // e > -1-floor(sqrt(d)) -> muß |y| verkleinern.
                x = sqrt(x); // x := (sqrt x)
                y = x-cl_float(1,x); // y := (- x 1) und
                e = float_exponent(y); // e neu berechnen
@@ -201,15 +200,15 @@ const cl_LF lnx_ratseries (const cl_LF& x)
                if (zerop(x1_.mantissa))
                        break;
                var uintC lm = integer_length(x1_.mantissa);
-               var uintL me = cl_I_to_UL(- x1_.exponent);
+               var uintE me = cl_I_to_UE(- x1_.exponent);
                var cl_I p;
-               var uintC lq;
-               var cl_boolean last_step = cl_false;
+               var uintE lq;
+               var bool last_step = false;
                if (lm >= me) { // |x'| >= 1/2 ?
                        p = x1_.sign; // 1 or -1
                        lq = 1;
                } else {
-                       var uintL n = me - lm; // |x'| < 2^-n with n maximal
+                       var uintE n = me - lm; // |x'| < 2^-n with n maximal
                        // Set p to the first n bits of |x'|:
                        if (lm > n) {
                                p = x1_.mantissa >> (lm - n);
@@ -225,9 +224,9 @@ const cl_LF lnx_ratseries (const cl_LF& x)
                        // after the next big multiplication. This saves one
                        // big multiplication at the end.
                        if (2*n >= lm)
-                               last_step = cl_true;
+                               last_step = true;
                }
-               y = y + scale_float(cl_I_to_LF(p,len),-(sintC)lq);
+               y = y + scale_float(cl_I_to_LF(p,len),-(sintE)lq);
                if (last_step)
                        break;
                x = x * cl_exp_aux(-p,lq,len);