]> www.ginac.de Git - cln.git/blobdiff - include/cln/dfloat.h
2006-05-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
[cln.git] / include / cln / dfloat.h
index b70cb88b2b987537c166a48e015d902a61185855..2b9d0c7c6a9dd36114cc6eb3f2b0d7d4a9e22f8f 100644 (file)
@@ -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