]> www.ginac.de Git - cln.git/commitdiff
Get rid CL_REQUIRE/CL_PROVIDE(cl_fmt_scaleexp), it is not 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:06 +0000 (08:41 +0400)
Move a bunch of static objects (tenth, SF_zero, FF_zero, etc) into
the function get_float_params (which is the only user of those variables)
in order to avoid possible static order initialization problems.

src/real/format-output/cl_fmt_scaleexp.cc
src/real/format-output/cl_format.h

index 404b71ea3f0d7e1949f211c2795992c03214da56..f982a182b726c43396664b8424100bf3e1374134 100644 (file)
@@ -3,8 +3,6 @@
 // General includes.
 #include "cl_sysdep.h"
 
-CL_PROVIDE(cl_fmt_scaleexp)
-
 // Specification.
 #include "cl_format.h"
 
@@ -38,24 +36,24 @@ struct float_format_params {
                : zero(a), one(b), ten(c), tenth(d), lg2(e) {}
 };
 
-static const cl_RA tenth = (cl_RA)"1/10";
-static const cl_SF SF_zero = cl_RA_to_SF(0);
-static const cl_SF SF_one = cl_RA_to_SF(1);
-static const cl_SF SF_ten = cl_RA_to_SF(10);
-static const cl_SF SF_tenth = cl_RA_to_SF(tenth);
-static const cl_FF FF_zero = cl_RA_to_FF(0);
-static const cl_FF FF_one = cl_RA_to_FF(1);
-static const cl_FF FF_ten = cl_RA_to_FF(10);
-static const cl_FF FF_tenth = cl_RA_to_FF(tenth);
-static const cl_DF DF_zero = cl_RA_to_DF(0);
-static const cl_DF DF_one = cl_RA_to_DF(1);
-static const cl_DF DF_ten = cl_RA_to_DF(10);
-static const cl_DF DF_tenth = cl_RA_to_DF(tenth);
-static const cl_SF SF_lg2 = (cl_SF)"0.30103";
-static const cl_DF DF_lg2 = (cl_DF)"0.30102999566";
-
 static const float_format_params get_float_params (const cl_F& arg)
 {
+       static const cl_RA tenth = (cl_RA)"1/10";
+       static const cl_SF SF_zero = cl_RA_to_SF(0);
+       static const cl_SF SF_one = cl_RA_to_SF(1);
+       static const cl_SF SF_ten = cl_RA_to_SF(10);
+       static const cl_SF SF_tenth = cl_RA_to_SF(tenth);
+       static const cl_FF FF_zero = cl_RA_to_FF(0);
+       static const cl_FF FF_one = cl_RA_to_FF(1);
+       static const cl_FF FF_ten = cl_RA_to_FF(10);
+       static const cl_FF FF_tenth = cl_RA_to_FF(tenth);
+       static const cl_DF DF_zero = cl_RA_to_DF(0);
+       static const cl_DF DF_one = cl_RA_to_DF(1);
+       static const cl_DF DF_ten = cl_RA_to_DF(10);
+       static const cl_DF DF_tenth = cl_RA_to_DF(tenth);
+       static const cl_SF SF_lg2 = (cl_SF)"0.30103";
+       static const cl_DF DF_lg2 = (cl_DF)"0.30102999566";
+
        floattypecase(arg
        ,       return float_format_params(SF_zero,SF_one,SF_ten,SF_tenth,SF_lg2);
        ,       return float_format_params(FF_zero,FF_one,FF_ten,FF_tenth,SF_lg2);
@@ -115,4 +113,3 @@ const decoded_float format_scale_exponent (const cl_F& arg)
 
 }  // namespace cln
 
-CL_PROVIDE_END(cl_fmt_scaleexp)
index 6ee90436d426c0d6aadd527eb15ba1ff0108978c..04662e54374b9795d9638a15826249f6bd0cb194 100644 (file)
@@ -52,7 +52,6 @@ extern void format_integer (std::ostream& stream, const cl_I& arg, unsigned int
 // arg = mantissa * 10^n * sign (also 10^(n-1) <= abs(arg) < 10^n ).
 // (Bei arg=0.0: 0.0 und n=0.)
 extern const decoded_float format_scale_exponent (const cl_F& arg);
-CL_REQUIRE(cl_fmt_scaleexp)
 
 // format_float_to_string(arg,width,d,k,dmin)
 // ergibt einen String zum Floating-point arg:
@@ -70,7 +69,6 @@ struct digits_with_dot {
                : string(s), length(l), dot_comes_first(df), dot_comes_last(dl), dot_position(dp) {}
 };
 extern const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width, const sintL d, const sintL k, const sintL dmin);
-CL_REQUIRE(cl_fmt_floatstring)
 
 }  // namespace cln