* Functions on floating-point numbers::
* Conversion functions::
* Random number generators::
-* Obfuscating operators::
+* Modifying operators::
Constructing numbers
* Functions on floating-point numbers::
* Conversion functions::
* Random number generators::
-* Obfuscating operators::
+* Modifying operators::
@end menu
@node Constructing numbers
@end table
-@node Obfuscating operators
-@section Obfuscating operators
+@node Modifying operators
+@section Modifying operators
@cindex modifying operators
The modifying C/C++ operators @code{+=}, @code{-=}, @code{*=}, @code{/=},
@code{&=}, @code{|=}, @code{^=}, @code{<<=}, @code{>>=}
-are not available by default because their
-use tends to make programs unreadable. It is trivial to get away without
-them. However, if you feel that you absolutely need these operators
-to get happy, then add
-@example
-#define WANT_OBFUSCATING_OPERATORS
-@end example
-@cindex @code{WANT_OBFUSCATING_OPERATORS}
-to the beginning of your source files, before the inclusion of any CLN
-include files. This flag will enable the following operators:
+are all available.
For the classes @code{cl_N}, @code{cl_R}, @code{cl_RA},
@code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}:
The postfix operator @code{x--}.
@end table
-Note that by using these obfuscating operators, you wouldn't gain efficiency:
+Note that by using these modifying operators, you don't gain efficiency:
In CLN @samp{x += y;} is exactly the same as @samp{x = x+y;}, not more
efficient.
extern const cl_N acosh (const cl_N& z);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_N& operator+= (cl_N& x, const cl_N& y) { return x = x + y; }
inline cl_N& operator++ /* prefix */ (cl_N& x) { return x = plus1(x); }
inline void operator-- /* postfix */ (cl_N& x, int dummy) { (void)dummy; x = minus1(x); }
inline cl_N& operator*= (cl_N& x, const cl_N& y) { return x = x * y; }
inline cl_N& operator/= (cl_N& x, const cl_N& y) { return x = x / y; }
-#endif
// Runtime typing support.
extern double double_approx (const cl_DF& x);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_DF& operator+= (cl_DF& x, const cl_DF& y) { return x = x + y; }
inline cl_DF& operator+= (cl_DF& x, const double y) { return x = x + y; }
inline cl_DF& operator*= (cl_DF& x, const double y) { return x = x * y; }
inline cl_DF& operator/= (cl_DF& x, const cl_DF& y) { return x = x / y; }
inline cl_DF& operator/= (cl_DF& x, const double y) { return x = x / y; }
-#endif
/* */
extern double double_approx (const cl_FF& x);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_FF& operator+= (cl_FF& x, const cl_FF& y) { return x = x + y; }
inline cl_FF& operator+= (cl_FF& x, const float y) { return x = x + y; }
inline cl_FF& operator*= (cl_FF& x, const float y) { return x = x * y; }
inline cl_FF& operator/= (cl_FF& x, const cl_FF& y) { return x = x / y; }
inline cl_FF& operator/= (cl_FF& x, const float y) { return x = x / y; }
-#endif
CL_REQUIRE(cl_ieee)
{ return random_F(default_random_state,n); }
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_F& operator+= (cl_F& x, const cl_F& y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const float y) { return x = x + y; }
inline cl_F& operator/= (cl_F& x, const cl_F& y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const float y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const double y) { return x = x / y; }
-#endif
// Thrown when a floating-point exception occurs.
class floating_point_exception : public runtime_exception {
{ return logand(x,y); }
inline const cl_I operator~ (const cl_I& x)
{ return lognot(x); }
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_I& operator|= (cl_I& x, const cl_I& y) { return x = x | y; }
inline cl_I& operator^= (cl_I& x, const cl_I& y) { return x = x ^ y; }
inline cl_I& operator&= (cl_I& x, const cl_I& y) { return x = x & y; }
-#endif
// Addition/Subtraktion von Integers
{ return testrandom_I(default_random_state); }
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_I& operator+= (cl_I& x, const cl_I& y) { return x = x + y; }
inline cl_I& operator+= (cl_I& x, const int y) { return x = x + y; }
inline cl_I& operator/= (cl_I& x, const cl_I& y) { return x = x / y; }
inline cl_I& operator%= (cl_I& x, const cl_I& y) { return x = x % y; }
#endif
-#endif
// Runtime typing support.
extern double double_approx (const cl_LF& x);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_LF& operator+= (cl_LF& x, const cl_LF& y) { return x = x + y; }
inline cl_LF& operator++ /* prefix */ (cl_LF& x) { return x = plus1(x); }
inline void operator-- /* postfix */ (cl_LF& x, int dummy) { (void)dummy; x = minus1(x); }
inline cl_LF& operator*= (cl_LF& x, const cl_LF& y) { return x = x * y; }
inline cl_LF& operator/= (cl_LF& x, const cl_LF& y) { return x = x / y; }
-#endif
// Runtime typing support.
extern double double_approx (const cl_RA& x);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_RA& operator+= (cl_RA& x, const cl_RA& y) { return x = x + y; }
inline cl_RA& operator+= (cl_RA& x, const int y) { return x = x + y; }
inline void operator-- /* postfix */ (cl_RA& x, int dummy) { (void)dummy; x = minus1(x); }
inline cl_RA& operator*= (cl_RA& x, const cl_RA& y) { return x = x * y; }
inline cl_RA& operator/= (cl_RA& x, const cl_RA& y) { return x = x / y; }
-#endif
// Runtime typing support.
{ return random_R(default_random_state,n); }
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_R& operator+= (cl_R& x, const cl_R& y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const cl_R& y) { return x = x + y; }
inline cl_F& operator/= (cl_F& x, const long long y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const unsigned long long y) { return x = x / y; }
#endif
-#endif
// Complex operations, trivial for reals
extern double double_approx (const cl_SF& x);
-#ifdef WANT_OBFUSCATING_OPERATORS
// This could be optimized to use in-place operations.
inline cl_SF& operator+= (cl_SF& x, const cl_SF& y) { return x = x + y; }
inline cl_SF& operator++ /* prefix */ (cl_SF& x) { return x = plus1(x); }
inline void operator-- /* postfix */ (cl_SF& x, int dummy) { (void)dummy; x = minus1(x); }
inline cl_SF& operator*= (cl_SF& x, const cl_SF& y) { return x = x * y; }
inline cl_SF& operator/= (cl_SF& x, const cl_SF& y) { return x = x / y; }
-#endif
// Runtime typing support.