X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Fmisc%2Fcl_F_epspos.cc;h=1cba5b4866158c1069ff6214874a539c03c5240f;hb=8169a19b38c42588b39b21dae5bdb964e2f6b8c6;hp=f3ade60722ab5950d6902beb78786f2e4ded1ef0;hpb=c84c6db5d56829d69083c819688a973867694a2a;p=cln.git diff --git a/src/float/misc/cl_F_epspos.cc b/src/float/misc/cl_F_epspos.cc index f3ade60..1cba5b4 100644 --- a/src/float/misc/cl_F_epspos.cc +++ b/src/float/misc/cl_F_epspos.cc @@ -1,41 +1,23 @@ // float_epsilon(). // General includes. -#include "cl_sysdep.h" - -CL_PROVIDE(cl_F_epspos) +#include "base/cl_sysdep.h" // Specification. #include "cln/float.h" // Implementation. -#include "cl_F.h" -#include "cl_SF.h" -#include "cl_FF.h" -#include "cl_DF.h" -#include "cl_LF.h" -#include "cl_LF_impl.h" +#include "float/cl_F.h" +#include "float/sfloat/cl_SF.h" +#include "float/ffloat/cl_FF.h" +#include "float/dfloat/cl_DF.h" +#include "float/lfloat/cl_LF.h" +#include "float/lfloat/cl_LF_impl.h" namespace cln { -// Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1) -// ist ?F_epsilon = 2^-d*(1+2^(1-d)), d.h. Mantisse 10...01, Vorzeichen +. - -static const cl_SF SF_epsilon = - make_SF(0,SF_exp_mid-SF_mant_len,bit(SF_mant_len)+1); - -static const cl_FF FF_epsilon = - encode_FF(0,-FF_mant_len,bit(FF_mant_len)+1); - -static const cl_DF DF_epsilon = - #if (cl_word_size==64) - encode_DF(0,-DF_mant_len,bit(DF_mant_len)+1); - #else - encode_DF(0,-DF_mant_len,bit(DF_mant_len-32),1); - #endif - -inline const cl_LF LF_epsilon (uintC len) +static inline const cl_LF LF_epsilon (uintC len) { var Lfloat erg = allocate_lfloat(len,LF_exp_mid+1-intDsize*len,0); var uintD* ptr = &TheLfloat(erg)->data[0]; @@ -53,6 +35,22 @@ inline const cl_LF LF_epsilon (uintC len) const cl_F float_epsilon (float_format_t f) { + // Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1) + // ist ?F_epsilon = 2^-d*(1+2^(1-d)), d.h. Mantisse 10...01, Vorzeichen +. + + static const cl_SF SF_epsilon = + make_SF(0,SF_exp_mid-SF_mant_len,bit(SF_mant_len)+1); + + static const cl_FF FF_epsilon = + encode_FF(0,-FF_mant_len,bit(FF_mant_len)+1); + + static const cl_DF DF_epsilon = + #if (cl_word_size==64) + encode_DF(0,-DF_mant_len,bit(DF_mant_len)+1); + #else + encode_DF(0,-DF_mant_len,bit(DF_mant_len-32),1); + #endif + floatformatcase((uintC)f , return SF_epsilon; , return FF_epsilon; @@ -63,4 +61,3 @@ const cl_F float_epsilon (float_format_t f) } // namespace cln -CL_PROVIDE_END(cl_F_epspos)