1 // Public real number operations.
7 #include "cl_real_class.h"
8 #include "cl_rational_class.h"
9 #include "cl_integer_class.h"
11 #include "cl_floatformat.h"
12 #include "cl_random.h"
15 CL_DEFINE_AS_CONVERSION(cl_R)
18 // zerop(x) testet, ob (= x 0).
19 extern cl_boolean zerop (const cl_R& x);
21 // minusp(x) testet, ob (< x 0).
22 extern cl_boolean minusp (const cl_R& x);
24 // plusp(x) testet, ob (> x 0).
25 extern cl_boolean plusp (const cl_R& x);
28 // R_to_SF(x) wandelt eine reelle Zahl x in ein Short-Float um.
29 // < ergebnis: (coerce x 'short-float)
30 extern const cl_SF cl_R_to_SF (const cl_R& x);
32 // R_to_FF(x) wandelt eine reelle Zahl x in ein Single-Float um.
33 // < ergebnis: (coerce x 'single-float)
34 extern const cl_FF cl_R_to_FF (const cl_R& x);
36 // R_to_DF(x) wandelt eine reelle Zahl x in ein Double-Float um.
37 // < ergebnis: (coerce x 'double-float)
38 extern const cl_DF cl_R_to_DF (const cl_R& x);
40 // R_to_LF(x,len) wandelt eine reelle Zahl x in ein Long-Float mit len Digits um.
41 // > uintC len: gewünschte Anzahl Digits, >=LF_minlen
42 // < ergebnis: (coerce x `(long-float ,len))
43 extern const cl_LF cl_R_to_LF (const cl_R& x, uintC len);
45 // cl_float(x,y) wandelt eine reelle Zahl x in das Float-Format des
46 // Floats y um und rundet dabei nötigenfalls.
47 // > x: eine reelle Zahl
49 // < ergebnis: (float x y)
50 extern const cl_F cl_float (const cl_R& x, const cl_F& y);
52 // cl_float(x,f) wandelt eine reelle Zahl x in das Float-Format f um
53 // und rundet dabei nötigenfalls.
54 // > x: eine reelle Zahl
55 // > f: eine Float-Format-Spezifikation
56 // < ergebnis: (float x f)
57 extern const cl_F cl_float (const cl_R& x, cl_float_format_t f);
59 // cl_float(x) wandelt eine reelle Zahl x in ein Float um
60 // und rundet dabei nötigenfalls.
61 // > x: eine reelle Zahl
62 // < ergebnis: (float x)
63 // Abhängig von cl_default_float_format.
64 extern const cl_F cl_float (const cl_R& x);
67 // Liefert (- x), wo x eine reelle Zahl ist.
68 extern const cl_R operator- (const cl_R& x);
70 // Liefert (+ x y), wo x und y reelle Zahlen sind.
71 extern const cl_R operator+ (const cl_R& x, const cl_R& y);
72 // Spezialfall: x oder y Float -> Ergebnis Float
73 inline const cl_F operator+ (const cl_R& x, const cl_F& y)
74 { return The(cl_F)(x + The(cl_R)(y)); }
75 inline const cl_F operator+ (const cl_F& x, const cl_R& y)
76 { return The(cl_F)(The(cl_R)(x) + y); }
77 // Dem C++-Compiler muß man nun auch das Folgende sagen:
78 inline const cl_R operator+ (const int x, const cl_R& y)
79 { return cl_I(x) + y; }
80 inline const cl_R operator+ (const unsigned int x, const cl_R& y)
81 { return cl_I(x) + y; }
82 inline const cl_R operator+ (const long x, const cl_R& y)
83 { return cl_I(x) + y; }
84 inline const cl_R operator+ (const unsigned long x, const cl_R& y)
85 { return cl_I(x) + y; }
86 inline const cl_R operator+ (const cl_R& x, const int y)
87 { return x + cl_I(y); }
88 inline const cl_R operator+ (const cl_R& x, const unsigned int y)
89 { return x + cl_I(y); }
90 inline const cl_R operator+ (const cl_R& x, const long y)
91 { return x + cl_I(y); }
92 inline const cl_R operator+ (const cl_R& x, const unsigned long y)
93 { return x + cl_I(y); }
95 // Liefert (- x y), wo x und y reelle Zahlen sind.
96 extern const cl_R operator- (const cl_R& x, const cl_R& y);
97 // Spezialfall: x oder y Float -> Ergebnis Float
98 inline const cl_F operator- (const cl_R& x, const cl_F& y)
99 { return The(cl_F)(x - The(cl_R)(y)); }
100 inline const cl_F operator- (const cl_F& x, const cl_R& y)
101 { return The(cl_F)(The(cl_R)(x) - y); }
102 // Dem C++-Compiler muß man nun auch das Folgende sagen:
103 inline const cl_R operator- (const int x, const cl_R& y)
104 { return cl_I(x) - y; }
105 inline const cl_R operator- (const unsigned int x, const cl_R& y)
106 { return cl_I(x) - y; }
107 inline const cl_R operator- (const long x, const cl_R& y)
108 { return cl_I(x) - y; }
109 inline const cl_R operator- (const unsigned long x, const cl_R& y)
110 { return cl_I(x) - y; }
111 inline const cl_R operator- (const cl_R& x, const int y)
112 { return x - cl_I(y); }
113 inline const cl_R operator- (const cl_R& x, const unsigned int y)
114 { return x - cl_I(y); }
115 inline const cl_R operator- (const cl_R& x, const long y)
116 { return x - cl_I(y); }
117 inline const cl_R operator- (const cl_R& x, const unsigned long y)
118 { return x - cl_I(y); }
120 // Liefert (* x y), wo x und y reelle Zahlen sind.
121 extern const cl_R operator* (const cl_R& x, const cl_R& y);
122 // Dem C++-Compiler muß man auch das Folgende sagen (wg. `int * cl_F' u.ä.):
123 inline const cl_R operator* (const int x, const cl_R& y)
124 { return cl_I(x) * y; }
125 inline const cl_R operator* (const unsigned int x, const cl_R& y)
126 { return cl_I(x) * y; }
127 inline const cl_R operator* (const long x, const cl_R& y)
128 { return cl_I(x) * y; }
129 inline const cl_R operator* (const unsigned long x, const cl_R& y)
130 { return cl_I(x) * y; }
131 inline const cl_R operator* (const cl_R& x, const int y)
132 { return x * cl_I(y); }
133 inline const cl_R operator* (const cl_R& x, const unsigned int y)
134 { return x * cl_I(y); }
135 inline const cl_R operator* (const cl_R& x, const long y)
136 { return x * cl_I(y); }
137 inline const cl_R operator* (const cl_R& x, const unsigned long y)
138 { return x * cl_I(y); }
140 // Liefert (* x x), wo x eine reelle Zahl ist.
141 extern const cl_R square (const cl_R& x);
143 // Liefert (/ x y), wo x und y reelle Zahlen sind.
144 extern const cl_R operator/ (const cl_R& x, const cl_R& y);
145 // Spezialfall: x oder y Float -> Ergebnis Float
146 inline const cl_F operator/ (const cl_F& x, const cl_R& y)
147 { return The(cl_F)(The(cl_R)(x) / y); }
148 // Dem C++-Compiler muß man auch das Folgende sagen (wg. `int / cl_F' u.ä.):
149 inline const cl_R operator/ (const int x, const cl_R& y)
150 { return cl_I(x) / y; }
151 inline const cl_R operator/ (const unsigned int x, const cl_R& y)
152 { return cl_I(x) / y; }
153 inline const cl_R operator/ (const long x, const cl_R& y)
154 { return cl_I(x) / y; }
155 inline const cl_R operator/ (const unsigned long x, const cl_R& y)
156 { return cl_I(x) / y; }
157 inline const cl_R operator/ (const cl_R& x, const int y)
158 { return x / cl_I(y); }
159 inline const cl_R operator/ (const cl_R& x, const unsigned int y)
160 { return x / cl_I(y); }
161 inline const cl_R operator/ (const cl_R& x, const long y)
162 { return x / cl_I(y); }
163 inline const cl_R operator/ (const cl_R& x, const unsigned long y)
164 { return x / cl_I(y); }
166 // Liefert (abs x), wo x eine reelle Zahl ist.
167 extern const cl_R abs (const cl_R& x);
169 // recip(x) liefert (/ x), wo x eine reelle Zahl ist.
170 extern const cl_R recip (const cl_R& x);
172 // (1+ x), wo x eine reelle Zahl ist.
173 extern const cl_R plus1 (const cl_R& x);
175 // (1- x), wo x eine reelle Zahl ist.
176 extern const cl_R minus1 (const cl_R& x);
179 // Return type for rounding operators.
180 // x / y --> (q,r) with x = y*q+r.
186 cl_R_div_t (const cl_I& q, const cl_R& r) : quotient(q), remainder(r) {}
187 cl_R_div_t (const struct cl_I_div_t &);
188 cl_R_div_t (const struct cl_RA_div_t &);
189 cl_R_div_t (const struct cl_F_div_t &);
192 // floor2(x) liefert (floor x), wo x eine reelle Zahl ist.
193 extern const cl_R_div_t floor2 (const cl_R& x);
194 extern const cl_I floor1 (const cl_R& x);
196 // ceiling2(x) liefert (ceiling x), wo x eine reelle Zahl ist.
197 extern const cl_R_div_t ceiling2 (const cl_R& x);
198 extern const cl_I ceiling1 (const cl_R& x);
200 // truncate2(x) liefert (truncate x), wo x eine reelle Zahl ist.
201 extern const cl_R_div_t truncate2 (const cl_R& x);
202 extern const cl_I truncate1 (const cl_R& x);
204 // round2(x) liefert (round x), wo x eine reelle Zahl ist.
205 extern const cl_R_div_t round2 (const cl_R& x);
206 extern const cl_I round1 (const cl_R& x);
208 // floor2(x,y) liefert (floor x y), wo x und y reelle Zahlen sind.
209 extern const cl_R_div_t floor2 (const cl_R& x, const cl_R& y);
210 extern const cl_I floor1 (const cl_R& x, const cl_R& y);
212 // ceiling2(x,y) liefert (ceiling x y), wo x und y reelle Zahlen sind.
213 extern const cl_R_div_t ceiling2 (const cl_R& x, const cl_R& y);
214 extern const cl_I ceiling1 (const cl_R& x, const cl_R& y);
216 // truncate2(x,y) liefert (truncate x y), wo x und y reelle Zahlen sind.
217 extern const cl_R_div_t truncate2 (const cl_R& x, const cl_R& y);
218 extern const cl_I truncate1 (const cl_R& x, const cl_R& y);
220 // round2(x,y) liefert (round x y), wo x und y reelle Zahlen sind.
221 extern const cl_R_div_t round2 (const cl_R& x, const cl_R& y);
222 extern const cl_I round1 (const cl_R& x, const cl_R& y);
225 // Return type for frounding operators.
226 // x / y --> (q,r) with x = y*q+r.
232 cl_R_fdiv_t (const cl_F& q, const cl_R& r) : quotient(q), remainder(r) {}
233 cl_R_fdiv_t (const struct cl_F_fdiv_t &);
236 // ffloor2(x) liefert (ffloor x), wo x eine reelle Zahl ist.
237 extern const cl_R_fdiv_t ffloor2 (const cl_R& x);
238 extern const cl_F ffloor (const cl_R& x);
240 // fceiling2(x) liefert (fceiling x), wo x eine reelle Zahl ist.
241 extern const cl_R_fdiv_t fceiling2 (const cl_R& x);
242 extern const cl_F fceiling (const cl_R& x);
244 // ftruncate2(x) liefert (ftruncate x), wo x eine reelle Zahl ist.
245 extern const cl_R_fdiv_t ftruncate2 (const cl_R& x);
246 extern const cl_F ftruncate (const cl_R& x);
248 // fround2(x) liefert (fround x), wo x eine reelle Zahl ist.
249 extern const cl_R_fdiv_t fround2 (const cl_R& x);
250 extern const cl_F fround (const cl_R& x);
252 // ffloor2(x,y) liefert (ffloor x y), wo x und y reelle Zahlen sind.
253 extern const cl_R_fdiv_t ffloor2 (const cl_R& x, const cl_R& y);
254 extern const cl_F ffloor (const cl_R& x, const cl_R& y);
256 // fceiling2(x,y) liefert (fceiling x y), wo x und y reelle Zahlen sind.
257 extern const cl_R_fdiv_t fceiling2 (const cl_R& x, const cl_R& y);
258 extern const cl_F fceiling (const cl_R& x, const cl_R& y);
260 // ftruncate2(x,y) liefert (ftruncate x y), wo x und y reelle Zahlen sind.
261 extern const cl_R_fdiv_t ftruncate2 (const cl_R& x, const cl_R& y);
262 extern const cl_F ftruncate (const cl_R& x, const cl_R& y);
264 // fround2(x,y) liefert (fround x y), wo x und y reelle Zahlen sind.
265 extern const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y);
266 extern const cl_F fround (const cl_R& x, const cl_R& y);
269 // mod(x,y) = (mod x y), wo x und y reelle Zahlen sind.
270 extern const cl_R mod (const cl_R& x, const cl_R& y);
272 // rem(x,y) = (rem x y), wo x und y reelle Zahlen sind.
273 extern const cl_R rem (const cl_R& x, const cl_R& y);
276 // rational(x) liefert (rational x), wo x eine reelle Zahl ist.
277 extern const cl_RA rational (const cl_R& x);
279 inline const cl_RA rational (const cl_RA& x) { return x; }
282 // cl_equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit.
283 extern cl_boolean cl_equal (const cl_R& x, const cl_R& y);
284 // cl_equal_hashcode(x) liefert einen cl_equal-invarianten Hashcode für x.
285 extern uint32 cl_equal_hashcode (const cl_R& x);
287 // cl_compare(x,y) vergleicht zwei reelle Zahlen x und y.
288 // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x<y.
289 extern cl_signean cl_compare (const cl_R& x, const cl_R& y);
291 inline bool operator== (const cl_R& x, const cl_R& y)
292 { return cl_equal(x,y); }
293 inline bool operator!= (const cl_R& x, const cl_R& y)
294 { return !cl_equal(x,y); }
295 inline bool operator<= (const cl_R& x, const cl_R& y)
296 { return cl_compare(x,y)<=0; }
297 inline bool operator< (const cl_R& x, const cl_R& y)
298 { return cl_compare(x,y)<0; }
299 inline bool operator>= (const cl_R& x, const cl_R& y)
300 { return cl_compare(x,y)>=0; }
301 inline bool operator> (const cl_R& x, const cl_R& y)
302 { return cl_compare(x,y)>0; }
304 // max(x,y) liefert (max x y), wo x und y reelle Zahlen sind.
305 extern const cl_R max (const cl_R& x, const cl_R& y);
307 // min(x,y) liefert (min x y), wo x und y reelle Zahlen sind.
308 extern const cl_R min (const cl_R& x, const cl_R& y);
310 // signum(x) liefert (signum x), wo x eine reelle Zahl ist.
311 extern const cl_R signum (const cl_R& x);
313 // sqrt(x) = (sqrt x) zieht die Wurzel aus einer reellen Zahl x >=0.
314 extern const cl_R sqrt (const cl_R& x);
315 // sqrt(x) = (sqrt x) zieht die Wurzel aus einer rationalen Zahl x >=0.
316 extern const cl_R sqrt (const cl_RA& x);
318 // (expt x y), wo x eine reelle Zahl und y ein Integer ist.
319 extern const cl_R expt (const cl_R& x, sintL y);
320 extern const cl_R expt (const cl_R& x, const cl_I& y);
322 // rationalize(x) liefert (rationalize x), wo x eine reelle Zahl ist.
323 extern const cl_RA rationalize (const cl_R& x);
326 // Konversion zu einem C "float".
327 extern float cl_float_approx (const cl_R& x);
329 // Konversion zu einem C "double".
330 extern double cl_double_approx (const cl_R& x);
333 // Transcendental functions
336 // atan(x,y) liefert zu zwei reellen Zahlen x, y den Winkel von (x,y)
337 // in Polarkoordinaten. Ergebnis rational nur, wenn x>0 und y=0.
338 extern const cl_R atan (const cl_R& x, const cl_R& y);
339 // Spezialfall: y Float -> Ergebnis Float
340 inline const cl_F atan (const cl_R& x, const cl_F& y)
341 { return The(cl_F)(atan(x,The(cl_R)(y))); }
342 // Dem C++-Compiler muß man nun auch das Folgende sagen:
343 inline const cl_R atan (const cl_R& x, const int y)
344 { return atan(x,cl_I(y)); }
345 inline const cl_R atan (const cl_R& x, const unsigned int y)
346 { return atan(x,cl_I(y)); }
347 inline const cl_R atan (const cl_R& x, const long y)
348 { return atan(x,cl_I(y)); }
349 inline const cl_R atan (const cl_R& x, const unsigned long y)
350 { return atan(x,cl_I(y)); }
352 // atan(x) liefert den Arctan einer reellen Zahl x.
353 // Ergebnis rational nur, wenn x=0.
354 extern const cl_R atan (const cl_R& x);
355 // Spezialfall: x Float -> Ergebnis Float
356 inline const cl_F atan (const cl_F& x) { return The(cl_F)(atan(The(cl_R)(x))); }
357 // Dem C++-Compiler muß man nun auch das Folgende sagen:
358 inline const cl_R atan (const int x) { return atan(cl_I(x)); }
359 inline const cl_R atan (const unsigned int x) { return atan(cl_I(x)); }
360 inline const cl_R atan (const long x) { return atan(cl_I(x)); }
361 inline const cl_R atan (const unsigned long x) { return atan(cl_I(x)); }
363 // sin(x) liefert den Sinus (sin x) einer reellen Zahl x.
364 extern const cl_R sin (const cl_R& x);
365 // Dem C++-Compiler muß man nun auch das Folgende sagen:
366 inline const cl_R sin (const int x) { return sin(cl_I(x)); }
367 inline const cl_R sin (const unsigned int x) { return sin(cl_I(x)); }
368 inline const cl_R sin (const long x) { return sin(cl_I(x)); }
369 inline const cl_R sin (const unsigned long x) { return sin(cl_I(x)); }
371 // cos(x) liefert den Cosinus (cos x) einer reellen Zahl x.
372 extern const cl_R cos (const cl_R& x);
373 // Dem C++-Compiler muß man nun auch das Folgende sagen:
374 inline const cl_R cos (const int x) { return cos(cl_I(x)); }
375 inline const cl_R cos (const unsigned int x) { return cos(cl_I(x)); }
376 inline const cl_R cos (const long x) { return cos(cl_I(x)); }
377 inline const cl_R cos (const unsigned long x) { return cos(cl_I(x)); }
379 // cl_cos_sin(x) liefert ((cos x),(sin x)), beide Werte.
380 extern const cl_cos_sin_t cl_cos_sin (const cl_R& x);
382 // tan(x) liefert den Tangens (tan x) einer reellen Zahl x.
383 extern const cl_R tan (const cl_R& x);
384 // Dem C++-Compiler muß man nun auch das Folgende sagen:
385 inline const cl_R tan (const int x) { return tan(cl_I(x)); }
386 inline const cl_R tan (const unsigned int x) { return tan(cl_I(x)); }
387 inline const cl_R tan (const long x) { return tan(cl_I(x)); }
388 inline const cl_R tan (const unsigned long x) { return tan(cl_I(x)); }
390 // ln(x) liefert zu einer reellen Zahl x>0 die Zahl ln(x).
391 extern const cl_R ln (const cl_R& x);
392 // Dem C++-Compiler muß man nun auch das Folgende sagen:
393 inline const cl_R ln (const int x) { return ln(cl_I(x)); }
394 inline const cl_R ln (const unsigned int x) { return ln(cl_I(x)); }
395 inline const cl_R ln (const long x) { return ln(cl_I(x)); }
396 inline const cl_R ln (const unsigned long x) { return ln(cl_I(x)); }
398 // log(a,b) liefert zu reellen Zahlen a>0, b>0 die Zahl
399 // log(a,b)=ln(a)/ln(b).
400 // Ergebnis rational nur, wenn a=1 oder a und b rational.
401 extern const cl_R log (const cl_R& a, const cl_R& b);
403 // exp(x) liefert zu einer reellen Zahl x die Zahl exp(x).
404 extern const cl_R exp (const cl_R& x);
405 // Dem C++-Compiler muß man nun auch das Folgende sagen:
406 inline const cl_R exp (const int x) { return exp(cl_I(x)); }
407 inline const cl_R exp (const unsigned int x) { return exp(cl_I(x)); }
408 inline const cl_R exp (const long x) { return exp(cl_I(x)); }
409 inline const cl_R exp (const unsigned long x) { return exp(cl_I(x)); }
411 // sinh(x) liefert zu einer reellen Zahl x die Zahl sinh(x).
412 extern const cl_R sinh (const cl_R& x);
413 // Dem C++-Compiler muß man nun auch das Folgende sagen:
414 inline const cl_R sinh (const int x) { return sinh(cl_I(x)); }
415 inline const cl_R sinh (const unsigned int x) { return sinh(cl_I(x)); }
416 inline const cl_R sinh (const long x) { return sinh(cl_I(x)); }
417 inline const cl_R sinh (const unsigned long x) { return sinh(cl_I(x)); }
419 // cosh(x) liefert zu einer reellen Zahl x die Zahl cosh(x).
420 extern const cl_R cosh (const cl_R& x);
421 // Dem C++-Compiler muß man nun auch das Folgende sagen:
422 inline const cl_R cosh (const int x) { return cosh(cl_I(x)); }
423 inline const cl_R cosh (const unsigned int x) { return cosh(cl_I(x)); }
424 inline const cl_R cosh (const long x) { return cosh(cl_I(x)); }
425 inline const cl_R cosh (const unsigned long x) { return cosh(cl_I(x)); }
427 // cl_cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte.
428 extern const cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x);
430 // tanh(x) liefert zu einer reellen Zahl x die Zahl tanh(x).
431 extern const cl_R tanh (const cl_R& x);
432 // Dem C++-Compiler muß man nun auch das Folgende sagen:
433 inline const cl_R tanh (const int x) { return tanh(cl_I(x)); }
434 inline const cl_R tanh (const unsigned int x) { return tanh(cl_I(x)); }
435 inline const cl_R tanh (const long x) { return tanh(cl_I(x)); }
436 inline const cl_R tanh (const unsigned long x) { return tanh(cl_I(x)); }
439 // random_R(randomstate,n) liefert zu einer reellen Zahl n>0 eine Zufallszahl
441 extern const cl_R random_R (cl_random_state& randomstate, const cl_R& n);
443 inline const cl_R random_R (const cl_R& n)
444 { return random_R(cl_default_random_state,n); }
447 #ifdef WANT_OBFUSCATING_OPERATORS
448 // This could be optimized to use in-place operations.
449 inline cl_R& operator+= (cl_R& x, const cl_R& y) { return x = x + y; }
450 inline cl_F& operator+= (cl_F& x, const cl_R& y) { return x = x + y; }
451 inline cl_F& operator+= (cl_F& x, const cl_RA& y) { return x = x + y; }
452 inline cl_F& operator+= (cl_F& x, const cl_I& y) { return x = x + y; }
453 inline cl_R& operator+= (cl_R& x, const int y) { return x = x + y; }
454 inline cl_R& operator+= (cl_R& x, const unsigned int y) { return x = x + y; }
455 inline cl_R& operator+= (cl_R& x, const long y) { return x = x + y; }
456 inline cl_R& operator+= (cl_R& x, const unsigned long y) { return x = x + y; }
457 inline cl_F& operator+= (cl_F& x, const int y) { return x = x + y; }
458 inline cl_F& operator+= (cl_F& x, const unsigned int y) { return x = x + y; }
459 inline cl_F& operator+= (cl_F& x, const long y) { return x = x + y; }
460 inline cl_F& operator+= (cl_F& x, const unsigned long y) { return x = x + y; }
461 inline cl_R& operator++ /* prefix */ (cl_R& x) { return x = plus1(x); }
462 inline void operator++ /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = plus1(x); }
463 inline cl_R& operator-= (cl_R& x, const cl_R& y) { return x = x - y; }
464 inline cl_F& operator-= (cl_F& x, const cl_R& y) { return x = x - y; }
465 inline cl_F& operator-= (cl_F& x, const cl_RA& y) { return x = x - y; }
466 inline cl_F& operator-= (cl_F& x, const cl_I& y) { return x = x - y; }
467 inline cl_R& operator-= (cl_R& x, const int y) { return x = x - y; }
468 inline cl_R& operator-= (cl_R& x, const unsigned int y) { return x = x - y; }
469 inline cl_R& operator-= (cl_R& x, const long y) { return x = x - y; }
470 inline cl_R& operator-= (cl_R& x, const unsigned long y) { return x = x - y; }
471 inline cl_F& operator-= (cl_F& x, const int y) { return x = x - y; }
472 inline cl_F& operator-= (cl_F& x, const unsigned int y) { return x = x - y; }
473 inline cl_F& operator-= (cl_F& x, const long y) { return x = x - y; }
474 inline cl_F& operator-= (cl_F& x, const unsigned long y) { return x = x - y; }
475 inline cl_R& operator-- /* prefix */ (cl_R& x) { return x = minus1(x); }
476 inline void operator-- /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = minus1(x); }
477 inline cl_R& operator*= (cl_R& x, const cl_R& y) { return x = x * y; }
478 inline cl_R& operator/= (cl_R& x, const cl_R& y) { return x = x / y; }
479 inline cl_F& operator/= (cl_F& x, const cl_R& y) { return x = x / y; }
480 inline cl_F& operator/= (cl_F& x, const cl_RA& y) { return x = x / y; }
481 inline cl_F& operator/= (cl_F& x, const cl_I& y) { return x = x / y; }
482 inline cl_R& operator/= (cl_R& x, const int y) { return x = x / y; }
483 inline cl_R& operator/= (cl_R& x, const unsigned int y) { return x = x / y; }
484 inline cl_R& operator/= (cl_R& x, const long y) { return x = x / y; }
485 inline cl_R& operator/= (cl_R& x, const unsigned long y) { return x = x / y; }
486 inline cl_F& operator/= (cl_F& x, const int y) { return x = x / y; }
487 inline cl_F& operator/= (cl_F& x, const unsigned int y) { return x = x / y; }
488 inline cl_F& operator/= (cl_F& x, const long y) { return x = x / y; }
489 inline cl_F& operator/= (cl_F& x, const unsigned long y) { return x = x / y; }
493 // Complex operations, trivial for reals
495 inline const cl_R realpart (const cl_R& x)
499 inline const cl_R imagpart (const cl_R& x)
504 inline const cl_R conjugate (const cl_R& x)
510 // Debugging support.
512 extern int cl_R_debug_module;
513 static void* const cl_R_debug_dummy[] = { &cl_R_debug_dummy,
519 #endif /* _CL_REAL_H */