You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

424 lines
7.5 KiB

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=58678d4e7ac12cf7; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=he34NelZ5BR_9UZ-i5NgpLxe2vM6MTczMjM2MDAzMzMxNjMxMjU2MQ; Path=/; Expires=Sun, 24 Nov 2024 11:07:13 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Sat, 23 Nov 2024 11:07:15 GMT Transfer-Encoding: chunked 6b9f sp/cln_mirror - cln_mirror - Gitea: Git with a cup of tea
#include "exam.h"
#include <cln/ffloat.h>
#include <cln/ffloat_io.h>
static div_test ffloat_div_tests[] = {
{ "0.73739415", "0.6416277",
"1.1492554" },
{ "0.6736158", "-0.25522494",
"-2.6393025" },
{ "-0.44216943", "0.31134832",
"-1.420176" },
{ "-0.7041118", "-0.26929635",
"2.6146355" },
{ "0.3573562", "0.73521775",
"0.4860549" },
{ "-0.7661392", "0.77110463",
"-0.9935606" },
{ "-0.91306114", "1.6586358E9",
"-5.504892E-10" },
{ "-0.68994707", "4.0230333E8",
"-1.7149921E-9" },
{ "0.28498656", "-7.617844E9",
"-3.7410394E-11" },
{ "-0.72419757", "-9.226896E9",
"7.848767E-11" },
{ "0.8352187", "8.3102536E9",
"1.00504605E-10" },
{ "0.9707725", "3.3669448E9",
"2.8832445E-10" },
{ "0.50785017", "6.048824E-11",
"8.3958497E9" },
{ "-0.17675805", "4.1391092E-11",
"-4.270437E9" },
{ "-0.42162335", "-4.4007357E-11",
"9.580747E9" },
{ "-7.945299E-4", "-5.4965265E-11",
"1.4455128E7" },
{ "-0.65178335", "-9.78151E-12",
"6.6634228E10" },
{ "-0.6209788", "-3.8544803E-11",
"1.611057E10" },
{ "0.94332725", "-4.9823833E19",
"-1.8933253E-20" },
{ "0.30150706", "-4.9741757E19",
"-6.061448E-21" },
{ "-0.8478371", "-9.85865E18",
"8.5999306E-20" },
{ "-0.28524554", "3.1389898E19",
"-9.087176E-21" },
{ "-0.5260848", "-7.936286E19",
"6.6288534E-21" },
{ "-0.12941593", "-5.3575864E19",
"2.415564E-21" },
{ "-0.20859545", "-9.867267E-21",
"2.1140145E19" },
{ "0.35158414", "-8.2825064E-22",
"-4.2449002E20" },
{ "-0.05635804", "-2.2999601E-21",
"2.450392E19" },
{ "-0.003138721", "-3.3988403E-21",
"9.234682E17" },
{ "-0.91386896", "-5.8199337E-21",
"1.5702395E20" },
{ "-0.5374476", "2.256708E-21",
"-2.3815556E20" },
{ "1.9669795E9", "-0.58137333",
"-3.3833329E9" },
{ "-8.9879334E8", "0.35829848",
"-2.5085046E9" },
{ "-9.057627E9", "0.4849478",
"-1.867753E10" },
{ "3.687799E8", "-0.34055912",
"-1.082866E9" },
{ "-5.1049994E9", "-0.16858816",
"3.0280888E10" },
{ "-4.512774E9", "0.9385354",
"-4.8083154E9" },
{ "-1.9312024E9", "-8.3940613E9",
"0.2300677" },
{ "-8.2104387E9", "6.769607E9",
"-1.2128383" },
{ "-6.9613486E9", "4.576518E9",
"-1.5211015" },
{ "-1.486333E9", "1.2476433E9",
"-1.1913126" },
{ "-7.653413E9", "5.167656E9",
"-1.4810221" },
{ "-2.9815204E9", "8.942396E9",
"-0.33341402" },
{ "9.304549E9", "-5.8002263E-11",
"-1.60417E20" },
{ "-2.0750719E9", "1.272735E-11",
"-1.6304037E20" },
{ "-1.1557549E9", "-7.2220556E-11",
"1.6003129E19" },
{ "-3.3273495E9", "-9.9207274E-11",
"3.353937E19" },
{ "-3.2167434E9", "7.7474506E-11",
"-4.1520026E19" },
{ "4.4169416E9", "-4.638272E-11",
"-9.5228166E19" },
{ "-3.732909E9", "-2.2763849E18",
"1.6398409E-9" },
{ "-6.243126E9", "-4.1274483E19",
"1.5125873E-10" },
{ "4.7162563E9", "-7.524631E19",
"-6.267758E-11" },
{ "-1.3657349E9", "7.728982E19",
"-1.7670308E-11" },
{ "-4.6216906E8", "-7.972877E19",
"5.7967663E-12" },
{ "4.4542986E9", "3.1531836E19",
"1.4126353E-10" },
{ "1.4738977E9", "-9.8130876E-21",
"-1.5019714E29" },
{ "-5.918336E9", "2.9877495E-21",
"-1.9808676E30" },
{ "-3.7166292E9", "-1.0826009E-21",
"3.433056E30" },
{ "7.390683E9", "-2.1678685E-22",
"-3.4091935E31" },
{ "6.2302886E8", "8.9466635E-21",
"6.963812E28" },
{ "5.2357125E9", "4.854464E-22",
"1.0785356E31" },
{ "-2.7721167E-11", "0.99550104",
"-2.7846447E-11" },
{ "5.754337E-11", "-0.6344538",
"-9.06975E-11" },
{ "-7.663363E-11", "0.020810604",
"-3.6824317E-9" },
{ "3.2576632E-11", "0.6209498",
"5.2462586E-11" },
{ "-9.507874E-11", "-0.19174337",
"4.958645E-10" },
{ "-9.681176E-11", "-0.82680905",
"1.1709084E-10" },
{ "6.458532E-11", "3.442031E8",
"1.8763725E-19" },
{ "1.9113166E-11", "-7.0712125E9",
"-2.7029546E-21" },
{ "-2.0099402E-12", "2.600844E9",
"-7.7280303E-22" },
{ "-4.9634992E-12", "8.041176E9",
"-6.1726036E-22" },
{ "3.2738747E-12", "7.299675E9",
"4.484959E-22" },
{ "9.133733E-12", "-2.6318538E9",
"-3.470456E-21" },
{ "-3.4146054E-11", "-1.5331155E-11",
"2.227233" },
{ "6.06336E-11", "4.3750472E-11",
"1.385896" },
{ "-4.229064E-11", "-9.169808E-11",
"0.4611944" },
{ "6.166104E-11", "-3.5474658E-11",
"-1.7381715" },
{ "-3.979801E-11", "-1.9510412E-11",
"2.0398343" },
{ "9.726933E-11", "-5.6926824E-11",
"-1.7086731" },
{ "8.041786E-11", "2.3718388E19",
"3.3905282E-30" },
{ "-6.747094E-11", "-6.7324465E19",
"1.0021756E-30" },
{ "-3.0713255E-11", "-4.8310887E19",
"6.357419E-31" },
{ "-2.8496396E-11", "-4.9017306E19",
"5.813538E-31" },
{ "-9.354275E-12", "-9.035095E19",
"1.0353266E-31" },
{ "4.9274265E-12", "7.241873E19",
"6.8040775E-32" },
{ "-4.377009E-11", "7.138917E-21",
"-6.131195E9" },
{ "9.422678E-12", "-5.8862136E-21",
"-1.6008046E9" },
{ "-6.83782E-11", "-3.6098812E-21",
"1.8941952E10" },
{ "-8.1755075E-11", "-6.8725736E-21",
"1.1895846E10" },
{ "-6.360949E-11", "4.2976342E-21",
"-1.4801049E10" },
{ "3.3879413E-11", "-1.7169743E-21",
Author SHA1 Message Date
Richard Kreckel dd9e0f894e Initial revision 25 years ago
0 HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=d1659bce0affaadc; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=tKyRSd1ZqnjNnutAvhGK6a05Zt86MTczMjM2MDAzMjM0NzM2MjA1MQ; Path=/; Expires=Sun, 24 Nov 2024 11:07:12 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Sat, 23 Nov 2024 11:07:16 GMT Transfer-Encoding: chunked 4613a sp/cln_mirror - include/cln/real.h at d381abe5a4adc7d9c4d3159bc766459b8bed91d6 - cln_mirror - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

521 lines
21 KiB

// Public real number operations.
#ifndef _CL_REAL_H
#define _CL_REAL_H
#include "cln/number.h"
#include "cln/real_class.h"
#include "cln/rational_class.h"
#include "cln/integer_class.h"
#include "cln/float.h"
#include "cln/floatformat.h"
#include "cln/random.h"
namespace cln {
CL_DEFINE_AS_CONVERSION(cl_R)
// zerop(x) testet, ob (= x 0).
extern cl_boolean zerop (const cl_R& x);
// minusp(x) testet, ob (< x 0).
extern cl_boolean minusp (const cl_R& x);
// plusp(x) testet, ob (> x 0).
extern cl_boolean plusp (const cl_R& x);
// R_to_SF(x) wandelt eine reelle Zahl x in ein Short-Float um.
// < ergebnis: (coerce x 'short-float)
extern const cl_SF cl_R_to_SF (const cl_R& x);
// R_to_FF(x) wandelt eine reelle Zahl x in ein Single-Float um.
// < ergebnis: (coerce x 'single-float)
extern const cl_FF cl_R_to_FF (const cl_R& x);
// R_to_DF(x) wandelt eine reelle Zahl x in ein Double-Float um.
// < ergebnis: (coerce x 'double-float)
extern const cl_DF cl_R_to_DF (const cl_R& x);
// R_to_LF(x,len) wandelt eine reelle Zahl x in ein Long-Float mit len Digits um.
// > uintC len: gewünschte Anzahl Digits, >=LF_minlen
// < ergebnis: (coerce x `(long-float ,len))
extern const cl_LF cl_R_to_LF (const cl_R& x, uintC len);
// cl_float(x,y) wandelt eine reelle Zahl x in das Float-Format des
// Floats y um und rundet dabei nötigenfalls.
// > x: eine reelle Zahl
// > y: ein Float
// < ergebnis: (float x y)
extern const cl_F cl_float (const cl_R& x, const cl_F& y);
// cl_float(x,f) wandelt eine reelle Zahl x in das Float-Format f um
// und rundet dabei nötigenfalls.
// > x: eine reelle Zahl
// > f: eine Float-Format-Spezifikation
// < ergebnis: (float x f)
extern const cl_F cl_float (const cl_R& x, float_format_t f);
// cl_float(x) wandelt eine reelle Zahl x in ein Float um
// und rundet dabei nötigenfalls.
// > x: eine reelle Zahl
// < ergebnis: (float x)
// Abhängig von default_float_format.
extern const cl_F cl_float (const cl_R& x);
// Liefert (- x), wo x eine reelle Zahl ist.
extern const cl_R operator- (const cl_R& x);
// Liefert (+ x y), wo x und y reelle Zahlen sind.
extern const cl_R operator+ (const cl_R& x, const cl_R& y);
// Spezialfall: x oder y Float -> Ergebnis Float
inline const cl_F operator+ (const cl_R& x, const cl_F& y)
{ return The(cl_F)(x + The(cl_R)(y)); }
inline const cl_F operator+ (const cl_F& x, const cl_R& y)
{ return The(cl_F)(The(cl_R)(x) + y); }
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R operator+ (const int x, const cl_R& y)
{ return cl_I(x) + y; }
inline const cl_R operator+ (const unsigned int x, const cl_R& y)
{ return cl_I(x) + y; }
inline const cl_R operator+ (const long x, const cl_R& y)
{ return cl_I(x) + y; }
inline const cl_R operator+ (const unsigned long x, const cl_R& y)
{ return cl_I(x) + y; }
inline const cl_R operator+ (const cl_R& x, const int y)
{ return x + cl_I(y); }
inline const cl_R operator+ (const cl_R& x, const unsigned int y)
{ return x + cl_I(y); }
inline const cl_R operator+ (const cl_R& x, const long y)
{ return x + cl_I(y); }
inline const cl_R operator+ (const cl_R& x, const unsigned long y)
{ return x + cl_I(y); }
// Liefert (- x y), wo x und y reelle Zahlen sind.
extern const cl_R operator- (const cl_R& x, const cl_R& y);
// Spezialfall: x oder y Float -> Ergebnis Float
inline const cl_F operator- (const cl_R& x, const cl_F& y)
{ return The(cl_F)(x - The(cl_R)(y)); }
inline const cl_F operator- (const cl_F& x, const cl_R& y)
{ return The(cl_F)(The(cl_R)(x) - y); }
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R operator- (const int x, const cl_R& y)
{ return cl_I(x) - y; }
inline const cl_R operator- (const unsigned int x, const cl_R& y)
{ return cl_I(x) - y; }
inline const cl_R operator- (const long x, const cl_R& y)
{ return cl_I(x) - y; }
inline const cl_R operator- (const unsigned long x, const cl_R& y)
{ return cl_I(x) - y; }
inline const cl_R operator- (const cl_R& x, const int y)
{ return x - cl_I(y); }
inline const cl_R operator- (const cl_R& x, const unsigned int y)
{ return x - cl_I(y); }
inline const cl_R operator- (const cl_R& x, const long y)
{ return x - cl_I(y); }
inline const cl_R operator- (const cl_R& x, const unsigned long y)
{ return x - cl_I(y); }
// Liefert (* x y), wo x und y reelle Zahlen sind.
extern const cl_R operator* (const cl_R& x, const cl_R& y);
// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int * cl_F' u.ä.):
inline const cl_R operator* (const int x, const cl_R& y)
{ return cl_I(x) * y; }
inline const cl_R operator* (const unsigned int x, const cl_R& y)
{ return cl_I(x) * y; }
inline const cl_R operator* (const long x, const cl_R& y)
{ return cl_I(x) * y; }
inline const cl_R operator* (const unsigned long x, const cl_R& y)
{ return cl_I(x) * y; }
inline const cl_R operator* (const cl_R& x, const int y)
{ return x * cl_I(y); }
inline const cl_R operator* (const cl_R& x, const unsigned int y)
{ return x * cl_I(y); }
inline const cl_R operator* (const cl_R& x, const long y)
{ return x * cl_I(y); }
inline const cl_R operator* (const cl_R& x, const unsigned long y)
{ return x * cl_I(y); }
// Liefert (* x x), wo x eine reelle Zahl ist.
extern const cl_R square (const cl_R& x);
// Liefert (/ x y), wo x und y reelle Zahlen sind.
extern const cl_R operator/ (const cl_R& x, const cl_R& y);
// Spezialfall: x oder y Float -> Ergebnis Float
inline const cl_F operator/ (const cl_F& x, const cl_R& y)
{ return The(cl_F)(The(cl_R)(x) / y); }
// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int / cl_F' u.ä.):
inline const cl_R operator/ (const int x, const cl_R& y)
{ return cl_I(x) / y; }
inline const cl_R operator/ (const unsigned int x, const cl_R& y)
{ return cl_I(x) / y; }
inline const cl_R operator/ (const long x, const cl_R& y)
{ return cl_I(x) / y; }
inline const cl_R operator/ (const unsigned long x, const cl_R& y)
{ return cl_I(x) / y; }
inline const cl_R operator/ (const cl_R& x, const int y)
{ return x / cl_I(y); }
inline const cl_R operator/ (const cl_R& x, const unsigned int y)
{ return x / cl_I(y); }
inline const cl_R operator/ (const cl_R& x, const long y)
{ return x / cl_I(y); }
inline const cl_R operator/ (const cl_R& x, const unsigned long y)
{ return x / cl_I(y); }
// Liefert (abs x), wo x eine reelle Zahl ist.
extern const cl_R abs (const cl_R& x);
// recip(x) liefert (/ x), wo x eine reelle Zahl ist.
extern const cl_R recip (const cl_R& x);
// (1+ x), wo x eine reelle Zahl ist.
extern const cl_R plus1 (const cl_R& x);
// (1- x), wo x eine reelle Zahl ist.
extern const cl_R minus1 (const cl_R& x);
// Return type for rounding operators.
// x / y --> (q,r) with x = y*q+r.
struct cl_R_div_t {
cl_I quotient;
cl_R remainder;
// Constructor.
cl_R_div_t () {}
cl_R_div_t (const cl_I& q, const cl_R& r) : quotient(q), remainder(r) {}
cl_R_div_t (const struct cl_I_div_t &);
cl_R_div_t (const struct cl_RA_div_t &);
cl_R_div_t (const struct cl_F_div_t &);
};
// floor2(x) liefert (floor x), wo x eine reelle Zahl ist.
extern const cl_R_div_t floor2 (const cl_R& x);
extern const cl_I floor1 (const cl_R& x);
// ceiling2(x) liefert (ceiling x), wo x eine reelle Zahl ist.
extern const cl_R_div_t ceiling2 (const cl_R& x);
extern const cl_I ceiling1 (const cl_R& x);
// truncate2(x) liefert (truncate x), wo x eine reelle Zahl ist.
extern const cl_R_div_t truncate2 (const cl_R& x);
extern const cl_I truncate1 (const cl_R& x);
// round2(x) liefert (round x), wo x eine reelle Zahl ist.
extern const cl_R_div_t round2 (const cl_R& x);
extern const cl_I round1 (const cl_R& x);
// floor2(x,y) liefert (floor x y), wo x und y reelle Zahlen sind.
extern const cl_R_div_t floor2 (const cl_R& x, const cl_R& y);
extern const cl_I floor1 (const cl_R& x, const cl_R& y);
// ceiling2(x,y) liefert (ceiling x y), wo x und y reelle Zahlen sind.
extern const cl_R_div_t ceiling2 (const cl_R& x, const cl_R& y);
extern const cl_I ceiling1 (const cl_R& x, const cl_R& y);
// truncate2(x,y) liefert (truncate x y), wo x und y reelle Zahlen sind.
extern const cl_R_div_t truncate2 (const cl_R& x, const cl_R& y);
extern const cl_I truncate1 (const cl_R& x, const cl_R& y);
// round2(x,y) liefert (round x y), wo x und y reelle Zahlen sind.
extern const cl_R_div_t round2 (const cl_R& x, const cl_R& y);
extern const cl_I round1 (const cl_R& x, const cl_R& y);
// Return type for frounding operators.
// x / y --> (q,r) with x = y*q+r.
struct cl_R_fdiv_t {
cl_F quotient;
cl_R remainder;
// Constructor.
cl_R_fdiv_t () {}
cl_R_fdiv_t (const cl_F& q, const cl_R& r) : quotient(q), remainder(r) {}
cl_R_fdiv_t (const struct cl_F_fdiv_t &);
};
// ffloor2(x) liefert (ffloor x), wo x eine reelle Zahl ist.
extern const cl_R_fdiv_t ffloor2 (const cl_R& x);
extern const cl_F ffloor (const cl_R& x);
// fceiling2(x) liefert (fceiling x), wo x eine reelle Zahl ist.
extern const cl_R_fdiv_t fceiling2 (const cl_R& x);
extern const cl_F fceiling (const cl_R& x);
// ftruncate2(x) liefert (ftruncate x), wo x eine reelle Zahl ist.
extern const cl_R_fdiv_t ftruncate2 (const cl_R& x);
extern const cl_F ftruncate (const cl_R& x);
// fround2(x) liefert (fround x), wo x eine reelle Zahl ist.
extern const cl_R_fdiv_t fround2 (const cl_R& x);
extern const cl_F fround (const cl_R& x);
// ffloor2(x,y) liefert (ffloor x y), wo x und y reelle Zahlen sind.
extern const cl_R_fdiv_t ffloor2 (const cl_R& x, const cl_R& y);
extern const cl_F ffloor (const cl_R& x, const cl_R& y);
// fceiling2(x,y) liefert (fceiling x y), wo x und y reelle Zahlen sind.
extern const cl_R_fdiv_t fceiling2 (const cl_R& x, const cl_R& y);
extern const cl_F fceiling (const cl_R& x, const cl_R& y);
// ftruncate2(x,y) liefert (ftruncate x y), wo x und y reelle Zahlen sind.
extern const cl_R_fdiv_t ftruncate2 (const cl_R& x, const cl_R& y);
extern const cl_F ftruncate (const cl_R& x, const cl_R& y);
// fround2(x,y) liefert (fround x y), wo x und y reelle Zahlen sind.
extern const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y);
extern const cl_F fround (const cl_R& x, const cl_R& y);
// mod(x,y) = (mod x y), wo x und y reelle Zahlen sind.
extern const cl_R mod (const cl_R& x, const cl_R& y);
// rem(x,y) = (rem x y), wo x und y reelle Zahlen sind.
extern const cl_R rem (const cl_R& x, const cl_R& y);
// rational(x) liefert (rational x), wo x eine reelle Zahl ist.
extern const cl_RA rational (const cl_R& x);
// Spezialfall:
inline const cl_RA rational (const cl_RA& x) { return x; }
// equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit.
extern cl_boolean equal (const cl_R& x, const cl_R& y);
// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x.
extern uint32 equal_hashcode (const cl_R& x);
// compare(x,y) vergleicht zwei reelle Zahlen x und y.
// Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x<y.
extern cl_signean compare (const cl_R& x, const cl_R& y);
inline bool operator== (const cl_R& x, const cl_R& y)
{ return equal(x,y); }
inline bool operator!= (const cl_R& x, const cl_R& y)
{ return !equal(x,y); }
inline bool operator<= (const cl_R& x, const cl_R& y)
{ return compare(x,y)<=0; }
inline bool operator< (const cl_R& x, const cl_R& y)
{ return compare(x,y)<0; }
inline bool operator>= (const cl_R& x, const cl_R& y)
{ return compare(x,y)>=0; }
inline bool operator> (const cl_R& x, const cl_R& y)
{ return compare(x,y)>0; }
// max(x,y) liefert (max x y), wo x und y reelle Zahlen sind.
extern const cl_R max (const cl_R& x, const cl_R& y);
// min(x,y) liefert (min x y), wo x und y reelle Zahlen sind.
extern const cl_R min (const cl_R& x, const cl_R& y);
// signum(x) liefert (signum x), wo x eine reelle Zahl ist.
extern const cl_R signum (const cl_R& x);
// sqrt(x) = (sqrt x) zieht die Wurzel aus einer reellen Zahl x >=0.
extern const cl_R sqrt (const cl_R& x);
// sqrt(x) = (sqrt x) zieht die Wurzel aus einer rationalen Zahl x >=0.
extern const cl_R sqrt (const cl_RA& x);
// (expt x y), wo x eine reelle Zahl und y ein Integer ist.
extern const cl_R expt (const cl_R& x, sintL y);
extern const cl_R expt (const cl_R& x, const cl_I& y);
// rationalize(x) liefert (rationalize x), wo x eine reelle Zahl ist.
extern const cl_RA rationalize (const cl_R& x);
// Konversion zu einem C "float".
extern float float_approx (const cl_R& x);
// Konversion zu einem C "double".
extern double double_approx (const cl_R& x);
// Transcendental functions
// atan(x,y) liefert zu zwei reellen Zahlen x, y den Winkel von (x,y)
// in Polarkoordinaten. Ergebnis rational nur, wenn x>0 und y=0.
extern const cl_R atan (const cl_R& x, const cl_R& y);
// Spezialfall: y Float -> Ergebnis Float
inline const cl_F atan (const cl_R& x, const cl_F& y)
{ return The(cl_F)(atan(x,The(cl_R)(y))); }
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R atan (const cl_R& x, const int y)
{ return atan(x,cl_I(y)); }
inline const cl_R atan (const cl_R& x, const unsigned int y)
{ return atan(x,cl_I(y)); }
inline const cl_R atan (const cl_R& x, const long y)
{ return atan(x,cl_I(y)); }
inline const cl_R atan (const cl_R& x, const unsigned long y)
{ return atan(x,cl_I(y)); }
// atan(x) liefert den Arctan einer reellen Zahl x.
// Ergebnis rational nur, wenn x=0.
extern const cl_R atan (const cl_R& x);
// Spezialfall: x Float -> Ergebnis Float
inline const cl_F atan (const cl_F& x) { return The(cl_F)(atan(The(cl_R)(x))); }
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R atan (const int x) { return atan(cl_I(x)); }
inline const cl_R atan (const unsigned int x) { return atan(cl_I(x)); }
inline const cl_R atan (const long x) { return atan(cl_I(x)); }
inline const cl_R atan (const unsigned long x) { return atan(cl_I(x)); }
// sin(x) liefert den Sinus (sin x) einer reellen Zahl x.
extern const cl_R sin (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R sin (const int x) { return sin(cl_I(x)); }
inline const cl_R sin (const unsigned int x) { return sin(cl_I(x)); }
inline const cl_R sin (const long x) { return sin(cl_I(x)); }
inline const cl_R sin (const unsigned long x) { return sin(cl_I(x)); }
// cos(x) liefert den Cosinus (cos x) einer reellen Zahl x.
extern const cl_R cos (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R cos (const int x) { return cos(cl_I(x)); }
inline const cl_R cos (const unsigned int x) { return cos(cl_I(x)); }
inline const cl_R cos (const long x) { return cos(cl_I(x)); }
inline const cl_R cos (const unsigned long x) { return cos(cl_I(x)); }
// cos_sin(x) liefert ((cos x),(sin x)), beide Werte.
extern const cos_sin_t cos_sin (const cl_R& x);
// tan(x) liefert den Tangens (tan x) einer reellen Zahl x.
extern const cl_R tan (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R tan (const int x) { return tan(cl_I(x)); }
inline const cl_R tan (const unsigned int x) { return tan(cl_I(x)); }
inline const cl_R tan (const long x) { return tan(cl_I(x)); }
inline const cl_R tan (const unsigned long x) { return tan(cl_I(x)); }
// ln(x) liefert zu einer reellen Zahl x>0 die Zahl ln(x).
extern const cl_R ln (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R ln (const int x) { return ln(cl_I(x)); }
inline const cl_R ln (const unsigned int x) { return ln(cl_I(x)); }
inline const cl_R ln (const long x) { return ln(cl_I(x)); }
inline const cl_R ln (const unsigned long x) { return ln(cl_I(x)); }
// log(a,b) liefert zu reellen Zahlen a>0, b>0 die Zahl
// log(a,b)=ln(a)/ln(b).
// Ergebnis rational nur, wenn a=1 oder a und b rational.
extern const cl_R log (const cl_R& a, const cl_R& b);
// exp(x) liefert zu einer reellen Zahl x die Zahl exp(x).
extern const cl_R exp (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R exp (const int x) { return exp(cl_I(x)); }
inline const cl_R exp (const unsigned int x) { return exp(cl_I(x)); }
inline const cl_R exp (const long x) { return exp(cl_I(x)); }
inline const cl_R exp (const unsigned long x) { return exp(cl_I(x)); }
// sinh(x) liefert zu einer reellen Zahl x die Zahl sinh(x).
extern const cl_R sinh (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R sinh (const int x) { return sinh(cl_I(x)); }
inline const cl_R sinh (const unsigned int x) { return sinh(cl_I(x)); }
inline const cl_R sinh (const long x) { return sinh(cl_I(x)); }
inline const cl_R sinh (const unsigned long x) { return sinh(cl_I(x)); }
// cosh(x) liefert zu einer reellen Zahl x die Zahl cosh(x).
extern const cl_R cosh (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R cosh (const int x) { return cosh(cl_I(x)); }
inline const cl_R cosh (const unsigned int x) { return cosh(cl_I(x)); }
inline const cl_R cosh (const long x) { return cosh(cl_I(x)); }
inline const cl_R cosh (const unsigned long x) { return cosh(cl_I(x)); }
// cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte.
extern const cosh_sinh_t cosh_sinh (const cl_R& x);
// tanh(x) liefert zu einer reellen Zahl x die Zahl tanh(x).
extern const cl_R tanh (const cl_R& x);
// Dem C++-Compiler muß man nun auch das Folgende sagen:
inline const cl_R tanh (const int x) { return tanh(cl_I(x)); }
inline const cl_R tanh (const unsigned int x) { return tanh(cl_I(x)); }
inline const cl_R tanh (const long x) { return tanh(cl_I(x)); }
inline const cl_R tanh (const unsigned long x) { return tanh(cl_I(x)); }
// random_R(randomstate,n) liefert zu einer reellen Zahl n>0 eine Zufallszahl
// x mit 0 <= x < n.
extern const cl_R random_R (random_state& randomstate, const cl_R& n);
inline const cl_R random_R (const cl_R& n)
{ 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 cl_RA& y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const cl_I& y) { return x = x + y; }
inline cl_R& operator+= (cl_R& x, const int y) { return x = x + y; }
inline cl_R& operator+= (cl_R& x, const unsigned int y) { return x = x + y; }
inline cl_R& operator+= (cl_R& x, const long y) { return x = x + y; }
inline cl_R& operator+= (cl_R& x, const unsigned long y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const int y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const unsigned int y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const long y) { return x = x + y; }
inline cl_F& operator+= (cl_F& x, const unsigned long y) { return x = x + y; }
inline cl_R& operator++ /* prefix */ (cl_R& x) { return x = plus1(x); }
inline void operator++ /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = plus1(x); }
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 cl_RA& y) { return x = x - y; }
inline cl_F& operator-= (cl_F& x, const cl_I& y) { return x = x - y; }
inline cl_R& operator-= (cl_R& x, const int y) { return x = x - y; }
inline cl_R& operator-= (cl_R& x, const unsigned int y) { return x = x - y; }
inline cl_R& operator-= (cl_R& x, const long y) { return x = x - y; }
inline cl_R& operator-= (cl_R& x, const unsigned long y) { return x = x - y; }
inline cl_F& operator-= (cl_F& x, const int y) { return x = x - y; }
inline cl_F& operator-= (cl_F& x, const unsigned int y) { return x = x - y; }
inline cl_F& operator-= (cl_F& x, const long y) { return x = x - y; }
inline cl_F& operator-= (cl_F& x, const unsigned long y) { return x = x - y; }
inline cl_R& operator-- /* prefix */ (cl_R& x) { return x = minus1(x); }
inline void operator-- /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = minus1(x); }
inline cl_R& operator*= (cl_R& x, const cl_R& y) { return x = x * y; }
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 cl_RA& y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const cl_I& y) { return x = x / y; }
inline cl_R& operator/= (cl_R& x, const int y) { return x = x / y; }
inline cl_R& operator/= (cl_R& x, const unsigned int y) { return x = x / y; }
inline cl_R& operator/= (cl_R& x, const long y) { return x = x / y; }
inline cl_R& operator/= (cl_R& x, const unsigned long y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const int y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const unsigned int y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const long y) { return x = x / y; }
inline cl_F& operator/= (cl_F& x, const unsigned long y) { return x = x / y; }
#endif