Browse Source

Fix linking problems on some platforms caused by inline/non-inline versions

of same functions (obsoletes MAYBE_INLINE) [by Alexei Sheplyakov].
master
Richard Kreckel 18 years ago
parent
commit
ce250e91fb
  1. 128
      ChangeLog
  2. 8
      src/base/cl_inline.h
  3. 8
      src/base/cl_inline2.h
  4. 5
      src/base/cl_macros.h
  5. 131
      src/base/cl_maybe_inline.h
  6. 5
      src/base/string/cl_st_concat1.cc
  7. 5
      src/base/string/cl_st_concat2.cc
  8. 5
      src/base/string/cl_st_concat3.cc
  9. 1
      src/base/string/cl_st_make0.cc
  10. 5
      src/complex/algebraic/cl_C_abs.cc
  11. 3
      src/complex/algebraic/cl_C_abs_aux.cc
  12. 7
      src/complex/algebraic/cl_C_signum.cc
  13. 8
      src/complex/algebraic/cl_DF_hypot.cc
  14. 8
      src/complex/algebraic/cl_FF_hypot.cc
  15. 8
      src/complex/algebraic/cl_LF_hypot.cc
  16. 8
      src/complex/algebraic/cl_SF_hypot.cc
  17. 6
      src/complex/transcendental/cl_C_acosh.cc
  18. 10
      src/complex/transcendental/cl_C_asinh_aux.cc
  19. 10
      src/complex/transcendental/cl_C_atanh_aux.cc
  20. 8
      src/float/dfloat/division/cl_DF_fceil.cc
  21. 7
      src/float/dfloat/elem/cl_DF_div.cc
  22. 7
      src/float/dfloat/elem/cl_DF_ffloor.cc
  23. 3
      src/float/dfloat/elem/cl_DF_minusp.cc
  24. 5
      src/float/dfloat/elem/cl_DF_mul.cc
  25. 10
      src/float/dfloat/elem/cl_DF_plusp.cc
  26. 3
      src/float/dfloat/elem/cl_DF_zerop.cc
  27. 5
      src/float/dfloat/misc/cl_DF_abs.cc
  28. 3
      src/float/dfloat/misc/cl_DF_digits.cc
  29. 3
      src/float/dfloat/misc/cl_DF_eqhashcode.cc
  30. 3
      src/float/dfloat/misc/cl_DF_exponent.cc
  31. 3
      src/float/dfloat/misc/cl_DF_idecode.cc
  32. 8
      src/float/dfloat/misc/cl_DF_precision.cc
  33. 8
      src/float/dfloat/misc/cl_DF_sign.cc
  34. 10
      src/float/dfloat/misc/cl_DF_signum.cc
  35. 13
      src/float/elem/cl_F_minusp.cc
  36. 13
      src/float/elem/cl_F_plusp.cc
  37. 13
      src/float/elem/cl_F_zerop.cc
  38. 7
      src/float/ffloat/division/cl_FF_fceil.cc
  39. 7
      src/float/ffloat/elem/cl_FF_div.cc
  40. 7
      src/float/ffloat/elem/cl_FF_ffloor.cc
  41. 3
      src/float/ffloat/elem/cl_FF_minusp.cc
  42. 5
      src/float/ffloat/elem/cl_FF_mul.cc
  43. 10
      src/float/ffloat/elem/cl_FF_plusp.cc
  44. 3
      src/float/ffloat/elem/cl_FF_zerop.cc
  45. 7
      src/float/ffloat/misc/cl_FF_abs.cc
  46. 3
      src/float/ffloat/misc/cl_FF_digits.cc
  47. 3
      src/float/ffloat/misc/cl_FF_eqhashcode.cc
  48. 3
      src/float/ffloat/misc/cl_FF_exponent.cc
  49. 6
      src/float/ffloat/misc/cl_FF_idecode.cc
  50. 8
      src/float/ffloat/misc/cl_FF_precision.cc
  51. 8
      src/float/ffloat/misc/cl_FF_sign.cc
  52. 10
      src/float/ffloat/misc/cl_FF_signum.cc
  53. 7
      src/float/lfloat/division/cl_LF_fceil.cc
  54. 9
      src/float/lfloat/elem/cl_LF_compare.cc
  55. 7
      src/float/lfloat/elem/cl_LF_ffloor.cc
  56. 3
      src/float/lfloat/elem/cl_LF_minusp.cc
  57. 10
      src/float/lfloat/elem/cl_LF_plusp.cc
  58. 5
      src/float/lfloat/elem/cl_LF_to_I.cc
  59. 3
      src/float/lfloat/elem/cl_LF_zerop.cc
  60. 7
      src/float/lfloat/misc/cl_LF_abs.cc
  61. 3
      src/float/lfloat/misc/cl_LF_digits.cc
  62. 3
      src/float/lfloat/misc/cl_LF_eqhashcode.cc
  63. 3
      src/float/lfloat/misc/cl_LF_exponent.cc
  64. 3
      src/float/lfloat/misc/cl_LF_idecode.cc
  65. 8
      src/float/lfloat/misc/cl_LF_precision.cc
  66. 14
      src/float/lfloat/misc/cl_LF_shortenrel.cc
  67. 12
      src/float/lfloat/misc/cl_LF_shortenwith.cc
  68. 6
      src/float/lfloat/misc/cl_LF_sign.cc
  69. 8
      src/float/lfloat/misc/cl_LF_signum.cc
  70. 13
      src/float/misc/cl_F_abs.cc
  71. 11
      src/float/misc/cl_F_digits.cc
  72. 13
      src/float/misc/cl_F_eqhashcode.cc
  73. 13
      src/float/misc/cl_F_exponent.cc
  74. 13
      src/float/misc/cl_F_idecode.cc
  75. 5
      src/float/misc/cl_F_precision.cc
  76. 13
      src/float/misc/cl_F_sign.cc
  77. 14
      src/float/misc/cl_F_signum.cc
  78. 8
      src/float/sfloat/division/cl_SF_fceil.cc
  79. 8
      src/float/sfloat/division/cl_SF_ffloor.cc
  80. 11
      src/float/sfloat/elem/cl_SF_compare.cc
  81. 6
      src/float/sfloat/elem/cl_SF_minus.cc
  82. 3
      src/float/sfloat/elem/cl_SF_minusp.cc
  83. 11
      src/float/sfloat/elem/cl_SF_plusp.cc
  84. 5
      src/float/sfloat/elem/cl_SF_uminus.cc
  85. 3
      src/float/sfloat/elem/cl_SF_zerop.cc
  86. 7
      src/float/sfloat/misc/cl_SF_abs.cc
  87. 3
      src/float/sfloat/misc/cl_SF_digits.cc
  88. 3
      src/float/sfloat/misc/cl_SF_eqhashcode.cc
  89. 3
      src/float/sfloat/misc/cl_SF_exponent.cc
  90. 3
      src/float/sfloat/misc/cl_SF_idecode.cc
  91. 8
      src/float/sfloat/misc/cl_SF_precision.cc
  92. 6
      src/float/sfloat/misc/cl_SF_sign.cc
  93. 11
      src/float/sfloat/misc/cl_SF_signum.cc
  94. 11
      src/float/transcendental/cl_F_atanhx.cc
  95. 17
      src/float/transcendental/cl_F_atanx.cc
  96. 5
      src/float/transcendental/cl_F_exp.cc
  97. 7
      src/float/transcendental/cl_F_expx.cc
  98. 9
      src/float/transcendental/cl_F_lnx.cc
  99. 7
      src/float/transcendental/cl_F_sinhx.cc
  100. 7
      src/float/transcendental/cl_F_sinx.cc

128
ChangeLog

@ -1,3 +1,131 @@
2007-01-18 Alexei Sheplyakov <varg@theor.jinr.ru>
Fix linking problems on some platforms caused by inline/non-inline
versions of same functions (obsoletes MAYBE_INLINE):
* src/base/cl_maybe_inline.h: New file.
* src/base/cl_inline2.h: New file.
* src/base/cl_inline.h: New file.
* src/base/cl_macros.h: Pull in cl_maybe_inline.h.
* src/base/string/cl_st_concat1.cc: Use new CL_INLINE macros and the
new *_inline functions.
* src/base/string/cl_st_concat2.cc: Likewise.
* src/base/string/cl_st_concat3.cc: Likewise.
* src/complex/algebraic/cl_C_abs.cc: Likewise.
* src/complex/algebraic/cl_C_abs_aux.cc: Likewise.
* src/complex/algebraic/cl_C_signum.cc: Likewise.
* src/complex/algebraic/cl_DF_hypot.cc: Likewise.
* src/complex/algebraic/cl_FF_hypot.cc: Likewise.
* src/complex/algebraic/cl_LF_hypot.cc: Likewise.
* src/complex/algebraic/cl_SF_hypot.cc: Likewise.
* src/complex/transcendental/cl_C_acosh.cc: Likewise.
* src/complex/transcendental/cl_C_asinh_aux.cc: Likewise.
* src/complex/transcendental/cl_C_atanh_aux.cc: Likewise.
* src/float/dfloat/division/cl_DF_fceil.cc: Likewise.
* src/float/dfloat/elem/cl_DF_div.cc: Likewise.
* src/float/dfloat/elem/cl_DF_ffloor.cc: Likewise.
* src/float/dfloat/elem/cl_DF_minusp.cc: Likewise.
* src/float/dfloat/elem/cl_DF_mul.cc: Likewise.
* src/float/dfloat/elem/cl_DF_plusp.cc: Likewise.
* src/float/dfloat/elem/cl_DF_zerop.cc: Likewise.
* src/float/dfloat/misc/cl_DF_abs.cc: Likewise.
* src/float/dfloat/misc/cl_DF_digits.cc: Likewise.
* src/float/dfloat/misc/cl_DF_eqhashcode.cc: Likewise.
* src/float/dfloat/misc/cl_DF_exponent.cc: Likewise.
* src/float/dfloat/misc/cl_DF_idecode.cc: Likewise.
* src/float/dfloat/misc/cl_DF_precision.cc: Likewise.
* src/float/dfloat/misc/cl_DF_sign.cc: Likewise.
* src/float/dfloat/misc/cl_DF_signum.cc: Likewise.
* src/float/elem/cl_F_minusp.cc: Likewise.
* src/float/elem/cl_F_plusp.cc: Likewise.
* src/float/elem/cl_F_zerop.cc: Likewise.
* src/float/ffloat/division/cl_FF_fceil.cc: Likewise.
* src/float/ffloat/elem/cl_FF_div.cc: Likewise.
* src/float/ffloat/elem/cl_FF_ffloor.cc: Likewise.
* src/float/ffloat/elem/cl_FF_minusp.cc: Likewise.
* src/float/ffloat/elem/cl_FF_mul.cc: Likewise.
* src/float/ffloat/elem/cl_FF_plusp.cc: Likewise.
* src/float/ffloat/elem/cl_FF_zerop.cc: Likewise.
* src/float/ffloat/misc/cl_FF_abs.cc: Likewise.
* src/float/ffloat/misc/cl_FF_digits.cc: Likewise.
* src/float/ffloat/misc/cl_FF_eqhashcode.cc: Likewise.
* src/float/ffloat/misc/cl_FF_exponent.cc: Likewise.
* src/float/ffloat/misc/cl_FF_idecode.cc: Likewise.
* src/float/ffloat/misc/cl_FF_precision.cc: Likewise.
* src/float/ffloat/misc/cl_FF_sign.cc: Likewise.
* src/float/ffloat/misc/cl_FF_signum.cc: Likewise.
* src/float/lfloat/division/cl_LF_fceil.cc: Likewise.
* src/float/lfloat/elem/cl_LF_compare.cc: Likewise.
* src/float/lfloat/elem/cl_LF_ffloor.cc: Likewise.
* src/float/lfloat/elem/cl_LF_minusp.cc: Likewise.
* src/float/lfloat/elem/cl_LF_plusp.cc: Likewise.
* src/float/lfloat/elem/cl_LF_to_I.cc: Likewise.
* src/float/lfloat/elem/cl_LF_zerop.cc: Likewise.
* src/float/lfloat/misc/cl_LF_abs.cc: Likewise.
* src/float/lfloat/misc/cl_LF_digits.cc: Likewise.
* src/float/lfloat/misc/cl_LF_eqhashcode.cc: Likewise.
* src/float/lfloat/misc/cl_LF_exponent.cc: Likewise.
* src/float/lfloat/misc/cl_LF_idecode.cc: Likewise.
* src/float/lfloat/misc/cl_LF_precision.cc: Likewise.
* src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise.
* src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise.
* src/float/lfloat/misc/cl_LF_sign.cc: Likewise.
* src/float/lfloat/misc/cl_LF_signum.cc: Likewise.
* src/float/misc/cl_F_abs.cc: Likewise.
* src/float/misc/cl_F_digits.cc: Likewise.
* src/float/misc/cl_F_eqhashcode.cc: Likewise.
* src/float/misc/cl_F_exponent.cc: Likewise.
* src/float/misc/cl_F_idecode.cc: Likewise.
* src/float/misc/cl_F_precision.cc: Likewise.
* src/float/misc/cl_F_sign.cc: Likewise.
* src/float/misc/cl_F_signum.cc: Likewise.
* src/float/sfloat/division/cl_SF_fceil.cc: Likewise.
* src/float/sfloat/division/cl_SF_ffloor.cc: Likewise.
* src/float/sfloat/elem/cl_SF_compare.cc: Likewise.
* src/float/sfloat/elem/cl_SF_minus.cc: Likewise.
* src/float/sfloat/elem/cl_SF_minusp.cc: Likewise.
* src/float/sfloat/elem/cl_SF_plusp.cc: Likewise.
* src/float/sfloat/elem/cl_SF_uminus.cc: Likewise.
* src/float/sfloat/elem/cl_SF_zerop.cc: Likewise.
* src/float/sfloat/misc/cl_SF_abs.cc: Likewise.
* src/float/sfloat/misc/cl_SF_digits.cc: Likewise.
* src/float/sfloat/misc/cl_SF_eqhashcode.cc: Likewise.
* src/float/sfloat/misc/cl_SF_exponent.cc: Likewise.
* src/float/sfloat/misc/cl_SF_idecode.cc: Likewise.
* src/float/sfloat/misc/cl_SF_precision.cc: Likewise.
* src/float/sfloat/misc/cl_SF_sign.cc: Likewise.
* src/float/sfloat/misc/cl_SF_signum.cc: Likewise.
* src/float/transcendental/cl_F_atanhx.cc: Likewise.
* src/float/transcendental/cl_F_atanx.cc: Likewise.
* src/float/transcendental/cl_F_exp.cc: Likewise.
* src/float/transcendental/cl_F_expx.cc: Likewise.
* src/float/transcendental/cl_F_lnx.cc: Likewise.
* src/float/transcendental/cl_F_sinhx.cc: Likewise.
* src/float/transcendental/cl_F_sinx.cc: Likewise.
* src/float/transcendental/cl_F_tan.cc: Likewise.
* src/float/transcendental/cl_F_tanh.cc: Likewise.
* src/integer/conv/cl_I_from_DS.cc: Likewise.
* src/integer/conv/cl_I_from_NDS.cc: Likewise.
* src/integer/conv/cl_I_from_NUDS.cc: Likewise.
* src/integer/conv/cl_I_from_UDS.cc: Likewise.
* src/integer/misc/cl_I_eqhashcode.cc: Likewise.
* src/integer/misc/cl_I_signum.cc: Likewise.
* src/integer/ring/cl_I_ring.cc: Likewise.
* src/rational/elem/cl_RA_minusp.cc: Likewise.
* src/rational/misc/cl_RA_eqhashcode.cc: Likewise.
* src/rational/misc/cl_RA_signum.cc: Likewise.
* src/rational/ring/cl_RA_ring.cc: Likewise.
* src/real/algebraic/cl_RA_sqrt.cc: Likewise.
* src/real/algebraic/cl_R_sqrt.cc: Likewise.
* src/real/conv/cl_F_from_R_def.cc: Likewise.
* src/real/elem/cl_R_minusp.cc: Likewise.
* src/real/elem/cl_R_zerop.cc: Likewise.
* src/real/misc/cl_R_eqhashcode.cc: Likewise.
* src/real/misc/cl_R_signum.cc: Likewise.
* src/real/transcendental/cl_R_tan.cc: Likewise.
* src/real/transcendental/cl_R_tanh.cc: Likewise.
* src/base/string/cl_st_make0.cc: Remove obsolete MAYBE_INLINE.
* src/rational/misc/Makeflags: Help compiler include cl_I_eqhashcode.cc.
2008-01-15 Bruno Haible <bruno@clisp.org>
* doc/cln.texi: Renamed from doc/cln.tex. Add @node lines and @menu

8
src/base/cl_inline.h

@ -0,0 +1,8 @@
/*
* Selectively inline a function in *some* translation units.
* See cl_maybe_inline.h file for the explanation.
*/
#undef CL_INLINE
#undef CL_INLINE_DECL
#define CL_INLINE static inline
#define CL_INLINE_DECL(fcn) CL_INLINE_HINT fcn ## _inline

8
src/base/cl_inline2.h

@ -0,0 +1,8 @@
/*
* Selectively inline a function in *some* translation units.
* See cl_maybe_inline.h file for the explanation.
*/
#undef CL_INLINE2
#undef CL_INLINE2_DECL
#define CL_INLINE2 static inline
#define CL_INLINE2_DECL(fcn) CL_INLINE_HINT fcn ## _inline

5
src/base/cl_macros.h

@ -265,9 +265,6 @@ public: \
// it's a shame!)
#define init1(type,lvalue) (void) new (&(lvalue)) type
// MAYBE_INLINE normally expands to nothing.
// Useful for including the implementation of some file inline into another.
#define MAYBE_INLINE
#define MAYBE_INLINE2
#include "cl_maybe_inline.h"
#endif /* _CL_MACROS_H */

131
src/base/cl_maybe_inline.h

@ -0,0 +1,131 @@
// CLN internal inlining hints
#ifndef _CL_MAYBE_INLINE_H
#define _CL_MAYBE_INLINE_H
/*
* Selectively inline a function in *some* translation units.
*
* The need to inline a function in some places and not in others came from
* three situations:
*
* 1) Some functions, like cl_SF_zerop or cl_FF_zerop, are just a single
* machine instruction when inlined. Putting their definitions into a public
* header would expose too many internals of the library, leading violation
* of abstraction and increased compilation times. Still, it would be nice
* to use the inline version of these functions in the library itself.
*
* 2) Some functions, like cl_{SF,FF,DF,LF}_idecode, are usually only
* invoked through a dispatcher cl_F_idecode that does nothing but dispatch
* the call to the right function. Here inlining is used, regardless of
* the size of the inlined functions, because it removes one function call
* from the chain of function calls. A compiler cannot know that this
* caller is the main caller for the 4 inlined functions.
*
* 3) Similarly, cl_I_from_NDS would be a bottleneck if not inlined: every
* creation of a new cl_I goes through this function. A compiler cannot
* know a priori the bottlenecks.
*
* Hence, there is a set of macros which help to create inline and
* non-inline versions of a function without duplicating the code.
*
* Usage:
*
* 1. In the public header, declare function as usual:
*
* extern cl_bar cl_foo(const cl_baz&);
*
* 2. Put the definition into a separate file, say, cl_foo.cc, in the
* following way:
*
* // cl_foo.cc
*
* #include "cl_macros.h"
* #include "whatever/you/need.h"
*
* CL_INLINE cl_bar CL_INLINE_DECL(cl_foo)(const cl_baz& x)
* {
* // the actual code goes here
* }
*
* This provides normal (non-inline) version of a function cl_foo.
*
* 3. In order to use the inline version, do
*
* // cl_blah.cc
*
* #include "cl_inline.h"
* #include "path/to/cl_foo.cc"
*
* This will declare and define function cl_foo_inline, which is an inline
* version of cl_foo.
*
* XXX:
* The name of the inline version *really* has to be different, since ISO C++
* demands (in 7.1.2.4)
*
* "If a function with external linkage is declared inline in one translation
* unit, it shall be declared inline in all translation units in which it
* appears; no diagnostic is required."
*
* Feel free to implement this functionality in a better *standard-compliant*
* way. Or submit a DR (defect report) to the standard committee.
*/
#define CL_INLINE
#define CL_INLINE_DECL(fcn) fcn
/*
* Use these macros to provide inline and non-inline versions of a function
* which uses an inline version of other function(s).
*/
#define CL_INLINE2
#define CL_INLINE2_DECL(fcn) fcn
/*
* Some functions (zerop, signum, etc) just dispatch the call to the
* appropriate type-specific functions. It would be nice to have these
* type-specific functions inlined. However, the compiler can not know that,
* unless one gives it a hint.
*
* Usage:
*
* const cl_foo CL_FLATTEN cl_bar(const cl_R& x)
* {
* // the actual code
* }
*
* Please note:
*
* 1. This is only a *hint*, it's always up to the compiler to NOT inline
* a function.
* 2. It's ignored if the optimization is switched off.
*/
#ifdef __GNUC__
#define CL_FLATTEN __attribute__((flatten))
#else
#define CL_FLATTEN
#endif
/*
* Tell the compiler to inline a function more aggressively, i.e. even if the
* optimization is switched off.
*
* Usage:
*
* cl_blah CL_INLINE_HINT cl_foo(const cl_baz& x)
* {
* // the actual code
* }
*
* Notes:
* 1. This is only a hint, it does NOT guarantee the function will be
* actually always inlined.
* 2. CL_INLINE and CL_INLINE2 macros set this attribute automagically.
*/
#ifdef __GNUC__
#define CL_INLINE_HINT __attribute__((always_inline))
#else
#define CL_INLINE_HINT
#endif
#endif /* _CL_MAYBE_INLINE_H */

5
src/base/string/cl_st_concat1.cc

@ -8,10 +8,7 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_st_make0.cc"
#include "cl_st_make0.h"
namespace cln {

5
src/base/string/cl_st_concat2.cc

@ -8,10 +8,7 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_st_make0.cc"
#include "cl_st_make0.h"
namespace cln {

5
src/base/string/cl_st_concat3.cc

@ -8,10 +8,7 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_st_make0.cc"
#include "cl_st_make0.h"
namespace cln {

1
src/base/string/cl_st_make0.cc

@ -14,7 +14,6 @@
namespace cln {
MAYBE_INLINE
cl_heap_string* cl_make_heap_string (unsigned long len)
{
var cl_heap_string* str = (cl_heap_string*) malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1));

5
src/complex/algebraic/cl_C_abs.cc

@ -12,8 +12,7 @@
#include "cl_C.h"
#include "cln/real.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_C_abs_aux.cc"
namespace cln {
@ -28,7 +27,7 @@ const cl_R abs (const cl_N& x)
return abs(x);
} else {
DeclareType(cl_C,x);
return abs(x);
return abs_inline(x);
}
}

3
src/complex/algebraic/cl_C_abs_aux.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
const cl_R abs (const cl_C& x)
CL_INLINE const cl_R CL_INLINE_DECL(abs) (const cl_C& x)
{
var const cl_R& a = realpart(x);
var const cl_R& b = imagpart(x);

7
src/complex/algebraic/cl_C_signum.cc

@ -12,13 +12,12 @@
#include "cl_C.h"
#include "cln/real.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_C_abs_aux.cc"
namespace cln {
const cl_N signum (const cl_N& x)
const cl_N CL_FLATTEN signum (const cl_N& x)
{
// Methode:
// x reell -> klar.
@ -31,7 +30,7 @@ const cl_N signum (const cl_N& x)
if (zerop(x))
return x;
else
return x / abs(x);
return x / abs_inline(x);
}
}

8
src/complex/algebraic/cl_DF_hypot.cc

@ -12,8 +12,8 @@
#include "cln/dfloat.h"
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
@ -37,7 +37,7 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b)
var uintL uexp = DF_uexp(TheDfloat(a)->dfloat_value_semhi);
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
return (minusp(b) ? -b : b);
return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - DF_exp_mid);
}
{
@ -45,7 +45,7 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b)
var uintL uexp = DF_uexp(TheDfloat(b)->dfloat_value_semhi);
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
return (minusp(a) ? -a : a);
return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - DF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).

8
src/complex/algebraic/cl_FF_hypot.cc

@ -12,8 +12,8 @@
#include "cln/ffloat.h"
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
@ -37,7 +37,7 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b)
var uintL uexp = FF_uexp(cl_ffloat_value(a));
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
return (minusp(b) ? -b : b);
return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - FF_exp_mid);
}
{
@ -45,7 +45,7 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b)
var uintL uexp = FF_uexp(cl_ffloat_value(b));
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
return (minusp(a) ? -a : a);
return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - FF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).

8
src/complex/algebraic/cl_LF_hypot.cc

@ -13,8 +13,8 @@
#include "cl_LF.h"
#include "cl_LF_impl.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
@ -53,7 +53,7 @@ const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b)
var uintE uexp = TheLfloat(a)->expo;
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
return (minusp(b) ? -b : b);
return (minusp_inline(b) ? -b : b);
a_exp = (sintE)(uexp - LF_exp_mid);
}
{
@ -61,7 +61,7 @@ const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b)
var uintE uexp = TheLfloat(b)->expo;
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
return (minusp(a) ? -a : a);
return (minusp_inline(a) ? -a : a);
b_exp = (sintE)(uexp - LF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).

8
src/complex/algebraic/cl_SF_hypot.cc

@ -12,8 +12,8 @@
#include "cln/sfloat.h"
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline copy of minusp */
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
@ -37,7 +37,7 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b)
var uintL uexp = SF_uexp(a);
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
return (minusp(b) ? -b : b);
return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - SF_exp_mid);
}
{
@ -45,7 +45,7 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b)
var uintL uexp = SF_uexp(b);
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
return (minusp(a) ? -a : a);
return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - SF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).

6
src/complex/transcendental/cl_C_acosh.cc

@ -16,8 +16,8 @@
#include "cl_RA.h"
#include "cln/float.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* Use inline version of cl_float -- cl_float_inline */
#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
@ -78,7 +78,7 @@ const cl_N acosh (const cl_N& z)
}
if (x < cl_I(-1)) {
// x < -1
var cl_F xf = cl_float(x);
var cl_F xf = cl_float_inline(x);
var cl_F& x = xf;
// x Float <= -1
// log(sqrt(x^2-1)-x), ein Float >=0, Imaginärteil pi

10
src/complex/transcendental/cl_C_asinh_aux.cc

@ -16,8 +16,8 @@
#include "cl_RA.h"
#include "cln/float.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* Use the inline version of cl_float */
#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
@ -89,7 +89,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y)
return cl_C_R(0,scale_float(pi(),-1));
if (eq(y,-1)) // x=0, y=-1 -> v = -pi/2
return cl_C_R(0,-scale_float(pi(),-1));
yf = cl_float(y); // y in Float umwandeln
yf = cl_float_inline(y); // y in Float umwandeln
} else {
DeclareType(cl_RT,y);
// y Ratio
@ -99,7 +99,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y)
if (eq(numerator(y),-1)) // x=0, y=-1/2 -> v = -pi/6
return cl_C_R(0,-(pi()/6));
}
yf = cl_float(y); // y in Float umwandeln
yf = cl_float_inline(y); // y in Float umwandeln
}
} else {
DeclareType(cl_F,y);
@ -135,7 +135,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y)
}
if (eq(y,0)) {
// y=0
var cl_F xf = cl_float(x); // x in Float umwandeln
var cl_F xf = cl_float_inline(x); // x in Float umwandeln
var cl_F& x = xf;
// x Float
if (zerop(x))

10
src/complex/transcendental/cl_C_atanh_aux.cc

@ -14,15 +14,15 @@
#include "cl_F_tran.h"
#include "cl_R.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* Use the inline version of cl_float */
#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v).
const cl_C_R atanh (const cl_R& x, const cl_R& y)
const cl_C_R CL_FLATTEN atanh (const cl_R& x, const cl_R& y)
{
// Methode:
// Wert und Branch Cuts nach der Formel CLTL2, S. 315:
@ -56,7 +56,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y)
// x=0 -> u=0, v=atan(X=1,Y=y) (Fall y=0 ist inbegriffen)
return cl_C_R(0, atan(1,y));
if (eq(y,0)) {
var cl_F xf = cl_float(x); // (float x)
var cl_F xf = cl_float_inline(x); // (float x)
var cl_F& x = xf;
// x Float
if (zerop(x))
@ -92,7 +92,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y)
var cl_F yf;
if (rationalp(x)) {
DeclareType(cl_RA,x);
yf = cl_float(y);
yf = cl_float_inline(y);
xf = cl_float(x,yf);
} else {
DeclareType(cl_F,x);

8
src/float/dfloat/division/cl_DF_fceil.cc

@ -11,15 +11,15 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
const cl_DF fceiling (const cl_DF& x)
const cl_DF CL_FLATTEN fceiling (const cl_DF& x)
{
if (minusp(x))
if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);

7
src/float/dfloat/elem/cl_DF_div.cc

@ -16,8 +16,7 @@
#include "cl_DS.h"
#include "cl_ieee.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
@ -47,9 +46,9 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2)
#if defined(FAST_DOUBLE) && !defined(__i386__)
double_to_DF(DF_to_double(x1) / DF_to_double(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
!zerop(x1), // ein Ergebnis +/- 0.0
!zerop_inline(x1), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
zerop(x2), // Division durch Null abfangen
zerop_inline(x2), // Division durch Null abfangen
FALSE // kein NaN als Ergebnis möglich
);
#else

7
src/float/dfloat/elem/cl_DF_ffloor.cc

@ -11,15 +11,14 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
const cl_DF ffloor (const cl_DF& x)
const cl_DF CL_FLATTEN ffloor (const cl_DF& x)
{
if (minusp(x))
if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);

3
src/float/dfloat/elem/cl_DF_minusp.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool minusp (const cl_DF& x)
CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_DF& x)
{
#if (cl_word_size==64)
return (sint64)TheDfloat(x)->dfloat_value_semhi < 0;

5
src/float/dfloat/elem/cl_DF_mul.cc

@ -15,8 +15,7 @@
#include "cl_DS.h"
#include "cl_ieee.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
@ -43,7 +42,7 @@ const cl_DF operator* (const cl_DF& x1, const cl_DF& x2)
#ifdef FAST_DOUBLE
double_to_DF(DF_to_double(x1) * DF_to_double(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
!(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0
!(zerop_inline(x1) || zerop_inline(x2)), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich
);

10
src/float/dfloat/elem/cl_DF_plusp.cc

@ -11,19 +11,17 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
#include "cl_DF_zerop.cc"
namespace cln {
MAYBE_INLINE2
bool plusp (const cl_DF& x)
CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_DF& x)
{
if (minusp(x))
if (minusp_inline(x))
return false; // x<0 -> nein
elif (zerop(x))
elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.

3
src/float/dfloat/elem/cl_DF_zerop.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool zerop (const cl_DF& x)
CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_DF& x)
{
#if 0
return DF_uexp(TheDfloat(x)->dfloat_value_semhi) == 0;

5
src/float/dfloat/misc/cl_DF_abs.cc

@ -9,13 +9,12 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
const cl_DF abs (const cl_DF& x)
const cl_DF CL_FLATTEN abs (const cl_DF& x)
{
// x<0 -> (- x), x>=0 -> x
if (minusp(x)) return -x; else return x;

3
src/float/dfloat/misc/cl_DF_digits.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
uintC float_digits (const cl_DF& x)
CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_DF& x)
{
unused x;
return DF_mant_len+1; // 53

3
src/float/dfloat/misc/cl_DF_eqhashcode.cc

@ -14,8 +14,7 @@
namespace cln {
MAYBE_INLINE
uint32 equal_hashcode (const cl_DF& x)
CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_DF& x)
{
var cl_signean sign;
var sintL exp;

3
src/float/dfloat/misc/cl_DF_exponent.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
sintE float_exponent (const cl_DF& x)
CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_DF& x)
{
var uintL uexp = DF_uexp(TheDfloat(x)->dfloat_value_semhi);
if (uexp==0) { return 0; }

3
src/float/dfloat/misc/cl_DF_idecode.cc

@ -14,8 +14,7 @@
namespace cln {
MAYBE_INLINE
const cl_idecoded_float integer_decode_float (const cl_DF& x)
CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_DF& x)
{
// x entpacken:
var cl_signean sign;

8
src/float/dfloat/misc/cl_DF_precision.cc

@ -11,16 +11,14 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
MAYBE_INLINE2
uintC float_precision (const cl_DF& x)
CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_DF& x)
{
if (zerop(x)) return 0;
if (zerop_inline(x)) return 0;
return DF_mant_len+1; // 53
}

8
src/float/dfloat/misc/cl_DF_sign.cc

@ -11,17 +11,15 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
MAYBE_INLINE2
const cl_DF float_sign (const cl_DF& x)
CL_INLINE2 const cl_DF CL_INLINE2_DECL(float_sign) (const cl_DF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return (!minusp(x) ? cl_DF_1 : cl_DF_minus1);
return (!minusp_inline(x) ? cl_DF_1 : cl_DF_minus1);
}
} // namespace cln

10
src/float/dfloat/misc/cl_DF_signum.cc

@ -11,18 +11,16 @@
#include "cl_DF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_DF_minusp.cc"
#include "cl_DF_zerop.cc"
namespace cln {
MAYBE_INLINE2
const cl_DF signum (const cl_DF& x)
CL_INLINE2 const cl_DF CL_INLINE2_DECL(signum) (const cl_DF& x)
{
if (minusp(x)) { return cl_DF_minus1; } // x<0 -> -1.0
elif (zerop(x)) { return cl_DF_0; } // x=0 -> 0.0
if (minusp_inline(x)) { return cl_DF_minus1; } // x<0 -> -1.0
elif (zerop_inline(x)) { return cl_DF_0; } // x=0 -> 0.0
else { return cl_DF_1; } // x>0 -> +1.0
}

13
src/float/elem/cl_F_minusp.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_FF_minusp.cc"
#include "cl_DF_minusp.cc"
@ -20,13 +19,13 @@
namespace cln {
bool minusp (const cl_F& x)
bool CL_FLATTEN minusp (const cl_F& x)
{
floatcase(x
, return minusp(x);
, return minusp(x);
, return minusp(x);
, return minusp(x);
, return minusp_inline(x);
, return minusp_inline(x);
, return minusp_inline(x);
, return minusp_inline(x);
);
}

13
src/float/elem/cl_F_plusp.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
#include "cl_inline2.h"
#include "cl_SF_plusp.cc"
#include "cl_FF_plusp.cc"
#include "cl_DF_plusp.cc"
@ -20,13 +19,13 @@
namespace cln {
bool plusp (const cl_F& x)
bool CL_FLATTEN plusp (const cl_F& x)
{
floatcase(x
, return plusp(x);
, return plusp(x);
, return plusp(x);
, return plusp(x);
, return plusp_inline(x);
, return plusp_inline(x);
, return plusp_inline(x);
, return plusp_inline(x);
);
}

13
src/float/elem/cl_F_zerop.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_zerop.cc"
#include "cl_FF_zerop.cc"
#include "cl_DF_zerop.cc"
@ -20,13 +19,13 @@
namespace cln {
bool zerop (const cl_F& x)
bool CL_FLATTEN zerop (const cl_F& x)
{
floatcase(x
, return zerop(x);
, return zerop(x);
, return zerop(x);
, return zerop(x);
, return zerop_inline(x);
, return zerop_inline(x);
, return zerop_inline(x);
, return zerop_inline(x);
);
}

7
src/float/ffloat/division/cl_FF_fceil.cc

@ -11,15 +11,14 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
const cl_FF fceiling (const cl_FF& x)
const cl_FF CL_FLATTEN fceiling (const cl_FF& x)
{
if (minusp(x))
if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);

7
src/float/ffloat/elem/cl_FF_div.cc

@ -15,8 +15,7 @@
#include "cl_low.h"
#include "cl_ieee.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
@ -46,9 +45,9 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2)
#if defined(FAST_FLOAT) && !defined(__i386__)
float_to_FF(FF_to_float(x1) / FF_to_float(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
!zerop(x1), // ein Ergebnis +/- 0.0
!zerop_inline(x1), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
zerop(x2), // Division durch Null abfangen
zerop_inline(x2), // Division durch Null abfangen
FALSE // kein NaN als Ergebnis möglich
);
#else

7
src/float/ffloat/elem/cl_FF_ffloor.cc

@ -11,15 +11,14 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
const cl_FF ffloor (const cl_FF& x)
const cl_FF CL_FLATTEN ffloor (const cl_FF& x)
{
if (minusp(x))
if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);

3
src/float/ffloat/elem/cl_FF_minusp.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool minusp (const cl_FF& x)
CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_FF& x)
{
return (sint32)cl_ffloat_value(x) < 0;
}

5
src/float/ffloat/elem/cl_FF_mul.cc

@ -14,8 +14,7 @@
#include "cl_low.h"
#include "cl_ieee.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
@ -42,7 +41,7 @@ const cl_FF operator* (const cl_FF& x1, const cl_FF& x2)
#ifdef FAST_FLOAT
float_to_FF(FF_to_float(x1) * FF_to_float(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
!(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0
!(zerop_inline(x1) || zerop_inline(x2)), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich
);

10
src/float/ffloat/elem/cl_FF_plusp.cc

@ -11,19 +11,17 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
#include "cl_FF_zerop.cc"
namespace cln {
MAYBE_INLINE2
bool plusp (const cl_FF& x)
CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_FF& x)
{
if (minusp(x))
if (minusp_inline(x))
return false; // x<0 -> nein
elif (zerop(x))
elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.

3
src/float/ffloat/elem/cl_FF_zerop.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool zerop (const cl_FF& x)
CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_FF& x)
{
return cl_ffloat_value(x) == 0;
}

7
src/float/ffloat/misc/cl_FF_abs.cc

@ -9,16 +9,15 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
const cl_FF abs (const cl_FF& x)
const cl_FF CL_FLATTEN abs (const cl_FF& x)
{
// x<0 -> (- x), x>=0 -> x
if (minusp(x)) return -x; else return x;
if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln

3
src/float/ffloat/misc/cl_FF_digits.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
uintC float_digits (const cl_FF& x)
CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_FF& x)
{
unused x;
return FF_mant_len+1; // 24

3
src/float/ffloat/misc/cl_FF_eqhashcode.cc

@ -14,8 +14,7 @@
namespace cln {
MAYBE_INLINE
uint32 equal_hashcode (const cl_FF& x)
CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_FF& x)
{
var cl_signean sign;
var sintL exp;

3
src/float/ffloat/misc/cl_FF_exponent.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
sintE float_exponent (const cl_FF& x)
CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_FF& x)
{
var uintL uexp = FF_uexp(cl_ffloat_value(x));
if (uexp==0) { return 0; }

6
src/float/ffloat/misc/cl_FF_idecode.cc

@ -21,8 +21,7 @@
namespace cln {
MAYBE_INLINE
const cl_idecoded_float integer_decode_float (const cl_FF& x)
CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_FF& x)
{
var cl_idecoded_float sem = integer_decode_float(cl_FF_to_DF(x));
return cl_idecoded_float(sem.mantissa >> (DF_mant_len-FF_mant_len),
@ -37,8 +36,7 @@ const cl_idecoded_float integer_decode_float (const cl_FF& x)
namespace cln {
MAYBE_INLINE
const cl_idecoded_float integer_decode_float (const cl_FF& x)
CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_FF& x)
{
// x entpacken:
var cl_signean sign;

8
src/float/ffloat/misc/cl_FF_precision.cc

@ -11,16 +11,14 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
MAYBE_INLINE2
uintC float_precision (const cl_FF& x)
CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_FF& x)
{
if (zerop(x)) return 0;
if (zerop_inline(x)) return 0;
return FF_mant_len+1; // 24
}

8
src/float/ffloat/misc/cl_FF_sign.cc

@ -11,17 +11,15 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
MAYBE_INLINE2
const cl_FF float_sign (const cl_FF& x)
CL_INLINE2 const cl_FF CL_INLINE2_DECL(float_sign) (const cl_FF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return (!minusp(x) ? cl_FF_1 : cl_FF_minus1);
return (!minusp_inline(x) ? cl_FF_1 : cl_FF_minus1);
}
} // namespace cln

10
src/float/ffloat/misc/cl_FF_signum.cc

@ -11,18 +11,16 @@
#include "cl_FF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_FF_minusp.cc"
#include "cl_FF_zerop.cc"
namespace cln {
MAYBE_INLINE2
const cl_FF signum (const cl_FF& x)
CL_INLINE2 const cl_FF CL_INLINE2_DECL(signum) (const cl_FF& x)
{
if (minusp(x)) { return cl_FF_minus1; } // x<0 -> -1.0
elif (zerop(x)) { return cl_FF_0; } // x=0 -> 0.0
if (minusp_inline(x)) { return cl_FF_minus1; } // x<0 -> -1.0
elif (zerop_inline(x)) { return cl_FF_0; } // x=0 -> 0.0
else { return cl_FF_1; } // x>0 -> +1.0
}

7
src/float/lfloat/division/cl_LF_fceil.cc

@ -11,15 +11,14 @@
#include "cl_LF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
const cl_LF fceiling (const cl_LF& x)
CL_INLINE2 const cl_LF CL_INLINE2_DECL(fceiling) (const cl_LF& x)
{
if (minusp(x))
if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);

9
src/float/lfloat/elem/cl_LF_compare.cc

@ -12,8 +12,7 @@
#include "cl_LF.h"
#include "cl_DS.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
@ -27,9 +26,9 @@ cl_signean compare (const cl_LF& x, const cl_LF& y)
// x und y haben gleiches Vorzeichen ->
// x >=0 -> vergleiche x und y (die rechten 24 Bits)
// x <0 -> vergleiche y und x (die rechten 24 Bits)
if (!minusp(y))
if (!minusp_inline(y))
// y>=0
{ if (!minusp(x))
{ if (!minusp_inline(x))
// y>=0, x>=0
{ // Vergleiche Exponenten und Mantissen:
{ var uintE x_uexp = TheLfloat(x)->expo;
@ -66,7 +65,7 @@ cl_signean compare (const cl_LF& x, const cl_LF& y)
{ return signean_minus; } // x<y
}
else
{ if (!minusp(x))
{ if (!minusp_inline(x))
// y<0, x>=0
{ return signean_plus; } // x>y
else

7
src/float/lfloat/elem/cl_LF_ffloor.cc

@ -11,15 +11,14 @@
#include "cl_LF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
const cl_LF ffloor (const cl_LF& x)
CL_INLINE2 const cl_LF CL_INLINE2_DECL(ffloor) (const cl_LF& x)
{
if (minusp(x))
if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);

3
src/float/lfloat/elem/cl_LF_minusp.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool minusp (const cl_LF& x)
CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_LF& x)
{
return -TheLfloat(x)->sign;
}

10
src/float/lfloat/elem/cl_LF_plusp.cc

@ -12,19 +12,17 @@
#include "cl_LF.h"
#include "cl_LF_impl.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_zerop.cc"
namespace cln {
MAYBE_INLINE2
bool plusp (const cl_LF& x)
CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_LF& x)
{
if (minusp(x))
if (minusp_inline(x))
return false; // x<0 -> nein
elif (zerop(x))
elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.

5
src/float/lfloat/elem/cl_LF_to_I.cc

@ -13,8 +13,7 @@
#include "cl_I.h"
#include "cl_DS.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
@ -36,7 +35,7 @@ const cl_I cl_LF_to_I (const cl_LF& x)
copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),MSDptr mspop 1,len); // Mantisse kopieren
mspref(MSDptr,0) = 0; // und zusätzliches Nulldigit
// Mantisse ist die UDS MSDptr/len1/LSDptr.
if (minusp(x))
if (minusp_inline(x))
// x<0 -> Mantisse negieren:
{ neg_loop_lsp(LSDptr,len1); }
// Vorzeichen*Mantisse ist die DS MSDptr/len1/LSDptr.

3
src/float/lfloat/elem/cl_LF_zerop.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool zerop (const cl_LF& x)
CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_LF& x)
{
return TheLfloat(x)->expo == 0;
}

7
src/float/lfloat/misc/cl_LF_abs.cc

@ -9,16 +9,15 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
const cl_LF abs (const cl_LF& x)
const cl_LF CL_FLATTEN abs (const cl_LF& x)
{
// x<0 -> (- x), x>=0 -> x
if (minusp(x)) return -x; else return x;
if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln

3
src/float/lfloat/misc/cl_LF_digits.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
uintC float_digits (const cl_LF& x)
CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_LF& x)
{
return intDsize*(uintC)(TheLfloat(x)->len);
}

3
src/float/lfloat/misc/cl_LF_eqhashcode.cc

@ -15,8 +15,7 @@
namespace cln {
MAYBE_INLINE
uint32 equal_hashcode (const cl_LF& x)
CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_LF& x)
{
var cl_signean sign;
var sintL exp;

3
src/float/lfloat/misc/cl_LF_exponent.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
sintE float_exponent (const cl_LF& x)
CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_LF& x)
{
var uintE uexp = TheLfloat(x)->expo;
if (uexp==0) { return 0; }

3
src/float/lfloat/misc/cl_LF_idecode.cc

@ -15,8 +15,7 @@
namespace cln {
MAYBE_INLINE
const cl_idecoded_float integer_decode_float (const cl_LF& x)
CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_LF& x)
{
// x entpacken:
var uintE uexp = TheLfloat(x)->expo;

8
src/float/lfloat/misc/cl_LF_precision.cc

@ -11,16 +11,14 @@
#include "cl_LF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_zerop.cc"
namespace cln {
MAYBE_INLINE2
uintC float_precision (const cl_LF& x)
CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_LF& x)
{
if (zerop(x)) return 0;
if (zerop_inline(x)) return 0;
return intDsize*(uintC)(TheLfloat(x)->len);
}

14
src/float/lfloat/misc/cl_LF_shortenrel.cc

@ -11,11 +11,9 @@
#include "cln/exception.h"
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
#include "cl_inline2.h"
#include "cl_LF_precision.cc"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_exponent.cc"
namespace cln {
@ -28,12 +26,12 @@ const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y)
// dx := float_digits(x), dy := float_digits(y).
// 1 ulp(x) = 2^(ex-dx), 1 ulp(y) = 2^(ey-dy).
// Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen.
var sintE ey = float_exponent(y);
var sintC dy = float_precision(y);
var sintE ey = float_exponent_inline(y);
var sintC dy = float_precision_inline(y);
if (dy==0) // zerop(y) ?
throw runtime_exception();
var sintE ex = float_exponent(x);
var sintC dx = float_precision(x);
var sintE ex = float_exponent_inline(x);
var sintC dx = float_precision_inline(x);
if (dx==0) // zerop(x) ?
return x;
var sintE d = ex - ey;

12
src/float/lfloat/misc/cl_LF_shortenwith.cc

@ -9,11 +9,9 @@
// Implementation.
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
#include "cl_inline2.h"
#include "cl_LF_precision.cc"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_exponent.cc"
namespace cln {
@ -25,9 +23,9 @@ const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y)
// ex := float_exponent(x), dx := float_digits(x), 1 ulp(x) = 2^(ex-dx).
// ey := float_exponent(y).
// Falls ex-dx < ey, x von Precision dx auf ex-ey verkürzen.
var sintE ey = float_exponent(y);
var sintE ex = float_exponent(x);
var uintC dx = float_precision(x);
var sintE ey = float_exponent_inline(y);
var sintE ex = float_exponent_inline(x);
var uintC dx = float_precision_inline(x);
if (dx==0) // zerop(x) ?
return x;
var sintE ulpx = ex - dx;

6
src/float/lfloat/misc/cl_LF_sign.cc

@ -12,14 +12,12 @@
#include "cl_LF.h"
#include "cl_LF_impl.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
MAYBE_INLINE2
const cl_LF float_sign (const cl_LF& x)
CL_INLINE2 const cl_LF CL_INLINE2_DECL(float_sign) (const cl_LF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len);

8
src/float/lfloat/misc/cl_LF_signum.cc

@ -12,17 +12,15 @@
#include "cl_LF.h"
#include "cl_LF_impl.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_zerop.cc"
namespace cln {
MAYBE_INLINE2
const cl_LF signum (const cl_LF& x)
CL_INLINE2 const cl_LF CL_INLINE2_DECL(signum) (const cl_LF& x)
{
if (zerop(x)) { return x; } // x=0 -> 0.0
if (zerop_inline(x)) { return x; } // x=0 -> 0.0
else // je nach Vorzeichen von x
{ return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len); }
}

13
src/float/misc/cl_F_abs.cc

@ -15,8 +15,7 @@
#include "cln/dfloat.h"
#include "cln/lfloat.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_FF_minusp.cc"
#include "cl_DF_minusp.cc"
@ -24,14 +23,14 @@
namespace cln {
const cl_F abs (const cl_F& x)
const cl_F CL_FLATTEN abs (const cl_F& x)
{
// x<0 -> (- x), x>=0 -> x
floatcase(x
, if (minusp(x)) return -x; else return x;
, if (minusp(x)) return -x; else return x;
, if (minusp(x)) return -x; else return x;
, if (minusp(x)) return -x; else return x;
, if (minusp_inline(x)) return -x; else return x;
, if (minusp_inline(x)) return -x; else return x;
, if (minusp_inline(x)) return -x; else return x;
, if (minusp_inline(x)) return -x; else return x;
);
}

11
src/float/misc/cl_F_digits.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_digits.cc"
#include "cl_FF_digits.cc"
#include "cl_DF_digits.cc"
@ -23,10 +22,10 @@ namespace cln {
uintC float_digits (const cl_F& x)
{
floatcase(x
, return float_digits(x);
, return float_digits(x);
, return float_digits(x);
, return float_digits(x);
, return float_digits_inline(x);
, return float_digits_inline(x);
, return float_digits_inline(x);
, return float_digits_inline(x);
);
}

13
src/float/misc/cl_F_eqhashcode.cc

@ -12,8 +12,7 @@
#include "cl_N.h"
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_eqhashcode.cc"
#include "cl_FF_eqhashcode.cc"
#include "cl_DF_eqhashcode.cc"
@ -21,13 +20,13 @@
namespace cln {
uint32 equal_hashcode (const cl_F& x)
uint32 CL_FLATTEN equal_hashcode (const cl_F& x)
{
floatcase(x
, return equal_hashcode(x);
, return equal_hashcode(x);
, return equal_hashcode(x);
, return equal_hashcode(x);
, return equal_hashcode_inline(x);
, return equal_hashcode_inline(x);
, return equal_hashcode_inline(x);
, return equal_hashcode_inline(x);
);
}

13
src/float/misc/cl_F_exponent.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_exponent.cc"
#include "cl_FF_exponent.cc"
#include "cl_DF_exponent.cc"
@ -20,13 +19,13 @@
namespace cln {
sintE float_exponent (const cl_F& x)
sintE CL_FLATTEN float_exponent (const cl_F& x)
{
floatcase(x
, return float_exponent(x);
, return float_exponent(x);
, return float_exponent(x);
, return float_exponent(x);
, return float_exponent_inline(x);
, return float_exponent_inline(x);
, return float_exponent_inline(x);
, return float_exponent_inline(x);
);
}

13
src/float/misc/cl_F_idecode.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_idecode.cc"
#include "cl_FF_idecode.cc"
#include "cl_DF_idecode.cc"
@ -20,13 +19,13 @@
namespace cln {
const cl_idecoded_float integer_decode_float (const cl_F& x)
const cl_idecoded_float CL_FLATTEN integer_decode_float (const cl_F& x)
{
floatcase(x
, return integer_decode_float(x);
, return integer_decode_float(x);
, return integer_decode_float(x);
, return integer_decode_float(x);
, return integer_decode_float_inline(x);
, return integer_decode_float_inline(x);
, return integer_decode_float_inline(x);
, return integer_decode_float_inline(x);
);
}

5
src/float/misc/cl_F_precision.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
#include "cl_inline2.h"
#include "cl_SF_precision.cc"
#include "cl_FF_precision.cc"
#include "cl_DF_precision.cc"
@ -20,7 +19,7 @@
namespace cln {
uintC float_precision (const cl_F& x)
uintC CL_FLATTEN float_precision (const cl_F& x)
{
floatcase(x
, return float_precision(x);

13
src/float/misc/cl_F_sign.cc

@ -11,8 +11,7 @@
#include "cl_F.h"
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
#include "cl_inline2.h"
#include "cl_SF_sign.cc"
#include "cl_FF_sign.cc"
#include "cl_DF_sign.cc"
@ -20,14 +19,14 @@
namespace cln {
const cl_F float_sign (const cl_F& x)
const cl_F CL_FLATTEN float_sign (const cl_F& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
floatcase(x
, return float_sign(x);
, return float_sign(x);
, return float_sign(x);
, return float_sign(x);
, return float_sign_inline(x);
, return float_sign_inline(x);
, return float_sign_inline(x);
, return float_sign_inline(x);
);
}

14
src/float/misc/cl_F_signum.cc

@ -11,8 +11,8 @@
#include "cl_F.h"
#undef MAYBE_INLINE2
#define MAYBE_INLINE2 inline
/* Use inline versions of signum(cl_{SF,FF,DF,LF}) functions */
#include "cl_inline2.h"
#include "cl_SF_signum.cc"
#include "cl_FF_signum.cc"
#include "cl_DF_signum.cc"
@ -20,13 +20,13 @@
namespace cln {
const cl_F signum (const cl_F& x)
const cl_F CL_FLATTEN signum (const cl_F& x)
{
floatcase(x
, return signum(x);
, return signum(x);
, return signum(x);
, return signum(x);
, return signum_inline(x);
, return signum_inline(x);
, return signum_inline(x);
, return signum_inline(x);
);
}

8
src/float/sfloat/division/cl_SF_fceil.cc

@ -11,15 +11,15 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
const cl_SF fceiling (const cl_SF& x)
const cl_SF CL_FLATTEN fceiling (const cl_SF& x)
{
if (minusp(x))
if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);

8
src/float/sfloat/division/cl_SF_ffloor.cc

@ -11,15 +11,15 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline version of minusp */
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
const cl_SF ffloor (const cl_SF& x)
const cl_SF CL_FLATTEN ffloor (const cl_SF& x)
{
if (minusp(x))
if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);

11
src/float/sfloat/elem/cl_SF_compare.cc

@ -9,13 +9,12 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
cl_signean compare (const cl_SF& x, const cl_SF& y)
cl_signean CL_FLATTEN compare (const cl_SF& x, const cl_SF& y)
{
// Methode:
// x und y haben verschiedenes Vorzeichen ->
@ -24,9 +23,9 @@ cl_signean compare (const cl_SF& x, const cl_SF& y)
// x und y haben gleiches Vorzeichen ->
// x >=0 -> vergleiche x und y (die rechten 24 Bits)
// x <0 -> vergleiche y und x (die rechten 24 Bits)
if (!minusp(y))
if (!minusp_inline(y))
// y>=0
{ if (!minusp(x))
{ if (!minusp_inline(x))
// y>=0, x>=0
{ if (x.word < y.word) return signean_minus; // x<y
if (x.word > y.word) return signean_plus; // x>y
@ -37,7 +36,7 @@ cl_signean compare (const cl_SF& x, const cl_SF& y)
{ return signean_minus; } // x<y
}
else
{ if (!minusp(x))
{ if (!minusp_inline(x))
// y<0, x>=0
{ return signean_plus; } // x>y
else

6
src/float/sfloat/elem/cl_SF_minus.cc

@ -11,8 +11,8 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* Use inline version of zerop */
#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
@ -21,7 +21,7 @@ const cl_SF operator- (const cl_SF& x1, const cl_SF& x2)
{
// Methode:
// (- x1 x2) = (+ x1 (- x2))
if (zerop(x2))
if (zerop_inline(x2))
return x1;
else
return x1 + cl_SF_from_word(x2.word ^ bit(SF_sign_shift));

3
src/float/sfloat/elem/cl_SF_minusp.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool minusp (const cl_SF& x)
CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_SF& x)
{
return (x.word & bit(SF_sign_shift)) != 0;
}

11
src/float/sfloat/elem/cl_SF_plusp.cc

@ -11,19 +11,18 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* For inline versions of minusp and zerop */
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_SF_zerop.cc"
namespace cln {
MAYBE_INLINE2
bool plusp (const cl_SF& x)
CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_SF& x)
{
if (minusp(x))
if (minusp_inline(x))
return false; // x<0 -> nein
elif (zerop(x))
elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.

5
src/float/sfloat/elem/cl_SF_uminus.cc

@ -11,8 +11,7 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
@ -21,7 +20,7 @@ const cl_SF operator- (const cl_SF& x)
{
// Methode:
// Falls x=0.0, fertig. Sonst Vorzeichenbit umdrehen.
if (zerop(x))
if (zerop_inline(x))
return SF_0;
return cl_SF_from_word(x.word ^ ((cl_uint)1 << SF_sign_shift));
}

3
src/float/sfloat/elem/cl_SF_zerop.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
bool zerop (const cl_SF& x)
CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_SF& x)
{
return x.word == make_SF_word(0,0,0);
}

7
src/float/sfloat/misc/cl_SF_abs.cc

@ -9,16 +9,15 @@
// Implementation.
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
const cl_SF abs (const cl_SF& x)
const cl_SF CL_FLATTEN abs (const cl_SF& x)
{
// x<0 -> (- x), x>=0 -> x
if (minusp(x)) return -x; else return x;
if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln

3
src/float/sfloat/misc/cl_SF_digits.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
uintC float_digits (const cl_SF& x)
CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_SF& x)
{
unused x;
return SF_mant_len+1; // 17

3
src/float/sfloat/misc/cl_SF_eqhashcode.cc

@ -14,8 +14,7 @@
namespace cln {
MAYBE_INLINE
uint32 equal_hashcode (const cl_SF& x)
CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_SF& x)
{
var cl_signean sign;
var sintL exp;

3
src/float/sfloat/misc/cl_SF_exponent.cc

@ -13,8 +13,7 @@
namespace cln {
MAYBE_INLINE
sintE float_exponent (const cl_SF& x)
CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_SF& x)
{
var uintL uexp = SF_uexp(x);
if (uexp==0) { return 0; }

3
src/float/sfloat/misc/cl_SF_idecode.cc

@ -14,8 +14,7 @@
namespace cln {
MAYBE_INLINE
const cl_idecoded_float integer_decode_float (const cl_SF& x)
CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_SF& x)
{
// x entpacken:
var cl_signean sign;

8
src/float/sfloat/misc/cl_SF_precision.cc

@ -11,16 +11,14 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
MAYBE_INLINE2
uintC float_precision (const cl_SF& x)
CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_SF& x)
{
if (zerop(x)) return 0;
if (zerop_inline(x)) return 0;
return SF_mant_len+1; // 17
}

6
src/float/sfloat/misc/cl_SF_sign.cc

@ -11,14 +11,12 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
MAYBE_INLINE2
const cl_SF float_sign (const cl_SF& x)
CL_INLINE2 const cl_SF CL_INLINE2_DECL(float_sign) (const cl_SF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return encode_SF(SF_sign(x),1,bit(SF_mant_len));

11
src/float/sfloat/misc/cl_SF_signum.cc

@ -11,18 +11,17 @@
#include "cl_SF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
/* Use inline versions of minusp and zerop */
#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_SF_zerop.cc"
namespace cln {
MAYBE_INLINE2
const cl_SF signum (const cl_SF& x)
CL_INLINE2 const cl_SF CL_INLINE2_DECL(signum) (const cl_SF& x)
{
if (minusp(x)) { return SF_minus1; } // x<0 -> -1.0
elif (zerop(x)) { return SF_0; } // x=0 -> 0.0
if (minusp_inline(x)) { return SF_minus1; } // x<0 -> -1.0
elif (zerop_inline(x)) { return SF_0; } // x=0 -> 0.0
else { return SF_1; } // x>0 -> +1.0
}

11
src/float/transcendental/cl_F_atanhx.cc

@ -15,8 +15,7 @@
#include "cln/float.h"
#include "cl_low.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"
@ -49,11 +48,11 @@ namespace cln {
const cl_LF atanhx (const cl_LF& x)
{
if (zerop(x))
if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE e = float_exponent(x);
var sintE e = float_exponent_inline(x);
if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
return x; // ja -> x als Ergebnis
if (actuallen >= 34) {
@ -77,13 +76,13 @@ const cl_LF atanhx (const cl_LF& x)
// nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen:
xx = sqrt(square(xx) + cl_float(-1,xx)) + xx;
k = k+1;
} until (float_exponent(xx) > e_limit);
} until (float_exponent_inline(xx) > e_limit);
// Schleifenende mit Exponent(x) > 1+limit_slope*floor(sqrt(d)),
// also x >= 2^(1+limit_slope*floor(sqrt(d))),
// also 1/x <= 2^(-1-limit_slope*floor(sqrt(d))).
// Nun kann die Potenzreihe auf 1/x angewandt werden.
xx = recip(xx);
if (minusp(x))
if (minusp_inline(x))
xx = - xx; // Vorzeichen wieder rein
}
// Potenzreihe anwenden:

17
src/float/transcendental/cl_F_atanx.cc

@ -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"
@ -47,11 +46,11 @@ namespace cln {
static const cl_LF atanx_naive (const cl_LF& x)
{
if (zerop(x))
if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE e = float_exponent(x);
var sintE e = float_exponent_inline(x);
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
@ -71,13 +70,13 @@ static const cl_LF atanx_naive (const cl_LF& x)
// nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen:
xx = sqrt(square(xx) + cl_float(1,xx)) + xx;
k = k+1;
} until (float_exponent(xx) > e_limit);
} until (float_exponent_inline(xx) > e_limit);
// Schleifenende mit Exponent(x) > 1+limit_slope*floor(sqrt(d)),
// also x >= 2^(1+limit_slope*floor(sqrt(d))),
// also 1/x <= 2^(-1-limit_slope*floor(sqrt(d))).
// Nun kann die Potenzreihe auf 1/x angewandt werden.
xx = recip(xx);
if (minusp(x))
if (minusp_inline(x))
xx = - xx; // Vorzeichen wieder rein
}
// Potenzreihe anwenden:
@ -184,13 +183,13 @@ static const cl_LF atanx_ratseries (const cl_LF& t)
// Set z := z + z' and x+i*y := (x+i*y)*exp(-i*z').
var uintC len = TheLfloat(t)->len;
var uintC d = intDsize*len;
if (zerop(t) || (float_exponent(t) <= (sintC)(-d)>>1))
if (zerop_inline(t) || (float_exponent_inline(t) <= (sintC)(-d)>>1))
return t;
var cl_LF x = recip(sqrt(cl_I_to_LF(1,len) + square(t)));
var cl_LF y = t*x;
var cl_LF z = cl_I_to_LF(0,len);
loop {
if (zerop(y) || (float_exponent(y) <= (sintC)(-d)>>1))
if (zerop_inline(y) || (float_exponent_inline(y) <= (sintC)(-d)>>1))
break;
var cl_idecoded_float y_ = integer_decode_float(y);
// y = (-1)^sign * 2^exponent * mantissa
@ -245,7 +244,7 @@ static const cl_LF atanx_ratseries (const cl_LF& t)
// 1000 167 112 65
// ==> ratseries faster for N >= 325.
const cl_F atanx (const cl_F& x)
const cl_F CL_FLATTEN atanx (const cl_F& x)
{
if (longfloatp(x)) {
DeclareType(cl_LF,x);

5
src/float/transcendental/cl_F_exp.cc

@ -15,8 +15,7 @@
#include "cln/lfloat.h"
#include "cl_LF.h"
#undef MAYBE_INLINE
#define MAYBE_INLINE inline
#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_exponent.cc"
@ -34,7 +33,7 @@ inline const cl_F_div_t cl_floor_ln2 (const cl_F& x)
inline const cl_LF_div_t cl_floor_ln2 (const cl_LF& x)
{
// Bei 0<=x<1/2 kann man sofort q:=0 setzen.
if (!minusp(x) && (float_exponent(x) < 0))
if (!minusp_inline(x) && (float_exponent_inline(x) < 0))
return cl_LF_div_t(0,x);
else
return floor2(x,The(cl_LF)(cl_ln2(x)));

7
src/float/transcendental/cl_F_expx.cc

@ -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_exponent.cc"
@ -44,11 +43,11 @@ const cl_LF expx_naive (const cl_LF& x)
{
// Methode:
// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation.
if (zerop(x))
if (zerop_inline(x))
return cl_float(1,x);
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE e = float_exponent(x);
var sintE e = float_exponent_inline(x);
if (e < -(sintC)d) // e < -d ?
return cl_float(1,x); // ja -> 1.0 als Ergebnis
{ Mutable(cl_LF,x);

9
src/float/transcendental/cl_F_lnx.cc

@ -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,11 +44,11 @@ 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 uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE 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);
@ -65,7 +64,7 @@ const cl_LF lnx_naive (const cl_LF& x)
// 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) {

7
src/float/transcendental/cl_F_sinhx.cc

@ -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_exponent.cc"
@ -112,11 +111,11 @@ const cl_LF sinhx_naive (const cl_LF& x)
// grob j=sqrt(2d) und damit k=sqrt(d).]
// Aufwand: asymptotisch d^2.5 .
if (zerop(x))
if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE e = float_exponent(x);
var sintE e = float_exponent_inline(x);
if (e <= (1-(sintC)d)>>1) // e <= (1-d)/2 <==> e <= -ceiling((d-1)/2) ?
return square(x); // ja -> x^2 als Ergebnis
{ Mutable(cl_LF,x);

7
src/float/transcendental/cl_F_sinx.cc

@ -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_exponent.cc"
@ -121,11 +120,11 @@ const cl_LF sinx_naive (const cl_LF& x)
// grob j=sqrt(2d) und damit k=sqrt(d).]
// Aufwand: asymptotisch d^2.5 .
if (zerop(x))
if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
var sintE e = float_exponent(x);
var sintE e = float_exponent_inline(x);
if (e <= (-(sintC)d)>>1) // e <= (-d)/2 <==> e <= -ceiling(d/2) ?
return square(x); // ja -> x^2 als Ergebnis
{ Mutable(cl_LF,x);

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save