]> www.ginac.de Git - cln.git/commitdiff
Get rid CL_REQUIRE/CL_PROVIDE(cl_F_epsneg), it is not really necessary.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Thu, 21 Aug 2008 12:06:02 +0000 (16:06 +0400)
committerAlexei Sheplyakov <varg@theor.jinr.ru>
Wed, 27 Aug 2008 04:41:07 +0000 (08:41 +0400)
Move static variables [SFDL]F_negative_epsilon into LF_negative_epsilon()
function (which is the only user of those variables) in order to avoid
possible static order initialization problems. While at it, make
LF_negative_epsilon() function static.

include/cln/float.h
src/float/misc/cl_F_epsneg.cc

index fe8a9c8fd749ad9c1c354bf4a0a1fa3473fd75fe..e3e953fe3c4a3895562bfda2c790d2b8e44cb2d1 100644 (file)
@@ -573,7 +573,6 @@ extern const cl_F float_epsilon (float_format_t f);
 
 // Returns the smallest floating point number e > 0 such that 1-e != 1.
 extern const cl_F float_negative_epsilon (float_format_t f);
-//CL_REQUIRE(cl_F_epsneg)
 
 
 // Konversion zu einem C "float".
index 8a8ba5a5440f5ecb7ef0ed5d17ef298b00ac20fe..577bce14d25db16abd60f1de6eb3b9cf6c8330b2 100644 (file)
@@ -3,8 +3,6 @@
 // General includes.
 #include "cl_sysdep.h"
 
-CL_PROVIDE(cl_F_epsneg)
-
 // Specification.
 #include "cln/float.h"
 
@@ -19,24 +17,7 @@ CL_PROVIDE(cl_F_epsneg)
 
 namespace cln {
 
-// Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1)
-// ist ?F_negative_epsilon = 2^(-d-1)*(1+2^(1-d)),
-// d.h. Mantisse 10...01, Vorzeichen +.
-
-static const cl_SF SF_negative_epsilon =
-       make_SF(0,SF_exp_mid-SF_mant_len-1,bit(SF_mant_len)+1);
-
-static const cl_FF FF_negative_epsilon =
-       encode_FF(0,-FF_mant_len-1,bit(FF_mant_len)+1);
-
-static const cl_DF DF_negative_epsilon =
-       #if (cl_word_size==64)
-         encode_DF(0,-DF_mant_len-1,bit(DF_mant_len)+1);
-       #else
-         encode_DF(0,-DF_mant_len-1,bit(DF_mant_len-32),1);
-       #endif
-
-inline const cl_LF LF_negative_epsilon (uintC len)
+static inline const cl_LF LF_negative_epsilon (uintC len)
 {
        var Lfloat erg = allocate_lfloat(len,LF_exp_mid-intDsize*len,0);
        var uintD* ptr = &TheLfloat(erg)->data[0];
@@ -54,6 +35,23 @@ inline const cl_LF LF_negative_epsilon (uintC len)
 
 const cl_F float_negative_epsilon (float_format_t f)
 {
+       // Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1)
+       // ist ?F_negative_epsilon = 2^(-d-1)*(1+2^(1-d)),
+       // d.h. Mantisse 10...01, Vorzeichen +.
+
+       static const cl_SF SF_negative_epsilon =
+               make_SF(0,SF_exp_mid-SF_mant_len-1,bit(SF_mant_len)+1);
+
+       static const cl_FF FF_negative_epsilon =
+               encode_FF(0,-FF_mant_len-1,bit(FF_mant_len)+1);
+
+       static const cl_DF DF_negative_epsilon =
+       #if (cl_word_size==64)
+               encode_DF(0,-DF_mant_len-1,bit(DF_mant_len)+1);
+       #else
+               encode_DF(0,-DF_mant_len-1,bit(DF_mant_len-32),1);
+       #endif
+
        floatformatcase((uintC)f
        ,       return SF_negative_epsilon;
        ,       return FF_negative_epsilon;
@@ -64,4 +62,3 @@ const cl_F float_negative_epsilon (float_format_t f)
 
 }  // namespace cln
 
-CL_PROVIDE_END(cl_F_epsneg)