]> www.ginac.de Git - cln.git/blobdiff - src/float/transcendental/cl_F_atanhx.cc
2006-04-25 Bruno Haible <bruno@clisp.org>
[cln.git] / src / float / transcendental / cl_F_atanhx.cc
index 24131d5fc2b9f583ff53a68ee9b740a7f00b5468..2d15ede2f1122349043c856b8f93c6ad0ad02b88 100644 (file)
@@ -6,13 +6,13 @@
 // Specification.
 #include "cl_F_tran.h"
 #include "cl_F.h"
-#include "cl_lfloat.h"
+#include "cln/lfloat.h"
 #include "cl_LF.h"
 
 
 // Implementation.
 
-#include "cl_float.h"
+#include "cln/float.h"
 #include "cl_low.h"
 
 #undef MAYBE_INLINE
@@ -21,6 +21,8 @@
 #include "cl_LF_minusp.cc"
 #include "cl_LF_exponent.cc"
 
+namespace cln {
+
 // cl_F atanhx (const cl_F& x)
 // cl_LF atanhx (const cl_LF& x)
 //
@@ -49,10 +51,10 @@ const cl_LF atanhx (const cl_LF& x)
 {
        if (zerop(x))
                return x;
-       var uintL actuallen = TheLfloat(x)->len;
-       var uintL d = float_digits(x);
+       var uintC actuallen = TheLfloat(x)->len;
+       var uintC d = float_digits(x);
        var sintL e = float_exponent(x);
-       if (e <= (sintL)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
+       if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
                return x; // ja -> x als Ergebnis
        if (actuallen >= 34) {
                DeclareType(cl_LF,x);
@@ -103,7 +105,7 @@ const cl_LF atanhx (const cl_LF& x)
        } else {
                // naive2:
                // floating-point representation with smooth precision reduction
-               var cl_LF eps = scale_float(b,-(sintL)d-10);
+               var cl_LF eps = scale_float(b,-(sintC)d-10);
                loop {
                        var cl_LF new_sum = sum + LF_to_LF(b/(cl_I)i,actuallen); // (+ sum (/ b i))
                        if (new_sum == sum) // = sum ?
@@ -127,9 +129,9 @@ const cl_F atanhx (const cl_F& x)
        }
        if (zerop(x))
                return x;
-       var uintL d = float_digits(x);
+       var uintC d = float_digits(x);
        var sintL e = float_exponent(x);
-       if (e <= (sintL)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
+       if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
                return x; // ja -> x als Ergebnis
        var uintL k = 0; // Rekursionszähler k:=0
        // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe
@@ -183,3 +185,5 @@ const cl_F atanhx (const cl_F& x)
 //  500    35.5    24.2     9.7
 // 1000   168     116      29.6
 // ==> using ln faster for N >= 34.
+
+}  // namespace cln