X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=include%2Fcln%2Fdfloat.h;h=2b9d0c7c6a9dd36114cc6eb3f2b0d7d4a9e22f8f;hb=c84c6db5d56829d69083c819688a973867694a2a;hp=b70cb88b2b987537c166a48e015d902a61185855;hpb=9d39b1f00ea895ddbc0b8b99d0de7609645d7dff;p=cln.git diff --git a/include/cln/dfloat.h b/include/cln/dfloat.h index b70cb88..2b9d0c7 100644 --- a/include/cln/dfloat.h +++ b/include/cln/dfloat.h @@ -47,18 +47,38 @@ extern cl_boolean plusp (const cl_DF& x); // Liefert zu zwei Double-Float x und y : (+ x y), ein DF. extern const cl_DF operator+ (const cl_DF& x, const cl_DF& y); +// The C++ compiler may hesitate to do these conversions of its own: +inline const cl_DF operator+ (const cl_DF& x, const double y) + { return x + cl_DF(y); } +inline const cl_DF operator+ (const double x, const cl_DF& y) + { return cl_DF(x) + y; } // Liefert zu zwei Double-Float x und y : (- x y), ein DF. extern const cl_DF operator- (const cl_DF& x, const cl_DF& y); +// The C++ compiler may hesitate to do these conversions of its own: +inline const cl_DF operator- (const cl_DF& x, const double y) + { return x - cl_DF(y); } +inline const cl_DF operator- (const double x, const cl_DF& y) + { return cl_DF(x) - y; } // Liefert zu zwei Double-Float x und y : (* x y), ein DF. extern const cl_DF operator* (const cl_DF& x, const cl_DF& y); +// The C++ compiler may hesitate to do these conversions of its own: +inline const cl_DF operator* (const cl_DF& x, const double y) + { return x * cl_DF(y); } +inline const cl_DF operator* (const double x, const cl_DF& y) + { return cl_DF(x) * y; } // Liefert zu einem Double-Float x : (* x x), ein DF. inline const cl_DF square (const cl_DF& x) { return x*x; } // Liefert zu zwei Double-Float x und y : (/ x y), ein DF. extern const cl_DF operator/ (const cl_DF& x, const cl_DF& y); +// The C++ compiler may hesitate to do these conversions of its own: +inline const cl_DF operator/ (const cl_DF& x, const double y) + { return x / cl_DF(y); } +inline const cl_DF operator/ (const double x, const cl_DF& y) + { return cl_DF(x) / y; } // Liefert zu einem Double-Float x>=0 : (sqrt x), ein DF. extern const cl_DF sqrt (const cl_DF& x); @@ -236,12 +256,12 @@ inline sintL float_radix (const cl_DF& x) extern const cl_DF float_sign (const cl_DF& x); // float_digits(x) liefert (float-digits x), wo x ein Float ist. -// < ergebnis: ein uintL >0 -extern uintL float_digits (const cl_DF& x); +// < ergebnis: ein uintC >0 +extern uintC float_digits (const cl_DF& x); // float_precision(x) liefert (float-precision x), wo x ein Float ist. -// < ergebnis: ein uintL >=0 -extern uintL float_precision (const cl_DF& x); +// < ergebnis: ein uintC >=0 +extern uintC float_precision (const cl_DF& x); // integer_decode_float(x) liefert zu einem Float x: (integer-decode-float x). @@ -252,7 +272,7 @@ extern const cl_idecoded_float integer_decode_float (const cl_DF& x); // scale_float(x,delta) liefert x*2^delta, wo x ein DF ist. -extern const cl_DF scale_float (const cl_DF& x, sintL delta); +extern const cl_DF scale_float (const cl_DF& x, sintC delta); extern const cl_DF scale_float (const cl_DF& x, const cl_I& delta); @@ -276,13 +296,17 @@ 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++ /* prefix */ (cl_DF& x) { return x = plus1(x); } inline void operator++ /* postfix */ (cl_DF& x, int dummy) { (void)dummy; x = plus1(x); } 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-- /* prefix */ (cl_DF& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_DF& x, int dummy) { (void)dummy; x = minus1(x); } 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 cl_DF& y) { return x = x / y; } +inline cl_DF& operator/= (cl_DF& x, const double y) { return x = x / y; } #endif