Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
DoubleAc Class Reference

#include <DoubleAc.h>

Public Member Functions

 DoubleAc (void)
 
 DoubleAc (const DoubleAc &f)
 
 DoubleAc (double f)
 
 DoubleAc (float f)
 
 DoubleAc (long f)
 
 DoubleAc (int f)
 
 DoubleAc (double f, double ffmin, double ffmax)
 
 DoubleAc (double f, double relative_prec)
 
DoubleAcoperator= (const DoubleAc &f)
 
DoubleAcoperator= (double f)
 
DoubleAcoperator= (float f)
 
DoubleAcoperator= (long f)
 
DoubleAcoperator= (int f)
 
 operator double (void) const
 
double get (void) const
 
double get_low_limit (void) const
 
double get_left_limit (void) const
 
double left_limit (void) const
 
double get_min_limit (void) const
 
double get_high_limit (void) const
 
double get_right_limit (void) const
 
double right_limit (void) const
 
double get_max_limit (void) const
 
double get_accuracy (void) const
 
DoubleAcoperator+= (const DoubleAc &f)
 
DoubleAcoperator+= (double f)
 
DoubleAcoperator+= (float f)
 
DoubleAcoperator+= (long f)
 
DoubleAcoperator+= (int f)
 
DoubleAcoperator-= (const DoubleAc &f)
 
DoubleAcoperator-= (double f)
 
DoubleAcoperator-= (float f)
 
DoubleAcoperator-= (long f)
 
DoubleAcoperator-= (int f)
 
DoubleAcoperator*= (DoubleAc f)
 
DoubleAcoperator*= (double f)
 
DoubleAcoperator*= (float f)
 
DoubleAcoperator*= (long f)
 
DoubleAcoperator*= (int f)
 
DoubleAcoperator/= (DoubleAc f)
 
DoubleAcoperator/= (double f)
 
DoubleAcoperator/= (float f)
 
DoubleAcoperator/= (long f)
 
DoubleAcoperator/= (int f)
 
void print (std::ostream &file, int l=1) const
 

Friends

void change_sign (DoubleAc &f)
 

Detailed Description

Definition at line 44 of file DoubleAc.h.

Constructor & Destructor Documentation

◆ DoubleAc() [1/8]

DoubleAc::DoubleAc ( void  )
inline

Definition at line 49 of file DoubleAc.h.

49 {
50 di = 0.0;
51 d = 0.0;
52 da = 0.0;
53 }

Referenced by operator+=(), and operator-=().

◆ DoubleAc() [2/8]

DoubleAc::DoubleAc ( const DoubleAc f)
inline

Definition at line 54 of file DoubleAc.h.

54 {
55 di = f.di;
56 d = f.d;
57 da = f.da;
58 }

◆ DoubleAc() [3/8]

DoubleAc::DoubleAc ( double  f)
inline

Definition at line 130 of file DoubleAc.h.

133 {
134 d = f;
135 if (f == 0.0) {
136 di = 0.0;
137 da = 0.0;
138 } else {
139 if (f > 0.0) {
140 if (f < DBL_MAX / one_plus_def_dbl_prec)
141 da = f * one_plus_def_dbl_prec;
142 else
143 da = f;
144 if (f > DBL_MIN * one_plus_def_dbl_prec)
145 di = f / one_plus_def_dbl_prec;
146 else
147 di = f;
148 } else {
149 if (-f < DBL_MAX / one_plus_def_dbl_prec)
150 di = f * one_plus_def_dbl_prec;
151 else
152 di = f;
153 if (-f > DBL_MIN * one_plus_def_dbl_prec)
154 da = f / one_plus_def_dbl_prec;
155 else
156 da = f;
157 }
158 }
159}
const double one_plus_def_dbl_prec
Definition: DoubleAc.h:37

◆ DoubleAc() [4/8]

DoubleAc::DoubleAc ( float  f)
inline

Definition at line 190 of file DoubleAc.h.

190 {
191 d = f;
192 if (f == 0.0) {
193 di = 0.0;
194 da = 0.0;
195 } else if (f > 0.0) {
196 di = f * one_minus_def_flt_prec;
197 da = f * one_plus_def_flt_prec;
198 } else {
199 da = f * one_minus_def_flt_prec;
200 di = f * one_plus_def_flt_prec;
201 }
202}
const double one_plus_def_flt_prec
Definition: DoubleAc.h:41
const double one_minus_def_flt_prec
Definition: DoubleAc.h:42

◆ DoubleAc() [5/8]

DoubleAc::DoubleAc ( long  f)
inline

Definition at line 219 of file DoubleAc.h.

219 {
220 d = f;
221 di = f;
222 da = f;
223}

◆ DoubleAc() [6/8]

DoubleAc::DoubleAc ( int  f)
inline

Definition at line 232 of file DoubleAc.h.

232 {
233 d = f;
234 di = f;
235 da = f;
236}

◆ DoubleAc() [7/8]

DoubleAc::DoubleAc ( double  f,
double  ffmin,
double  ffmax 
)

Definition at line 17 of file DoubleAc.cpp.

17 {
18 mfunname("DoubleAc::DoubleAc(double f, double ffmin, double ffmax)");
19 check_econd12a(f, <, ffmin, "f - ffmin=" << f - ffmin << '\n', mcerr);
20 check_econd12a(f, >, ffmax, "f - ffmax=" << f - ffmax << '\n', mcerr);
21 di = ffmin;
22 d = f;
23 da = ffmax;
24}
#define check_econd12a(a, sign, b, add, stream)
Definition: FunNameStack.h:411
#define mfunname(string)
Definition: FunNameStack.h:67
#define mcerr
Definition: prstream.h:135

◆ DoubleAc() [8/8]

DoubleAc::DoubleAc ( double  f,
double  relative_prec 
)

Definition at line 26 of file DoubleAc.cpp.

26 {
27 mfunname("DoubleAc::DoubleAc(double f, double relative_prec)");
28 check_econd11(relative_prec, < 0, mcerr);
29 check_econd11(relative_prec, >= 1, mcerr);
30 d = f;
31 if (f >= 0) {
32 da = f * (1.0 + relative_prec);
33 di = f / (1.0 + relative_prec);
34 } else {
35 di = f * (1.0 + relative_prec);
36 da = f / (1.0 + relative_prec);
37 }
38}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366

Member Function Documentation

◆ get()

double DoubleAc::get ( void  ) const
inline

Definition at line 76 of file DoubleAc.h.

76{ return d; }

Referenced by acos(), asin(), cos(), exp(), fabs(), find_max(), find_min(), inverse_DynArr_prot(), operator-(), pow(), sin(), sqrt(), and square().

◆ get_accuracy()

double DoubleAc::get_accuracy ( void  ) const
inline

Definition at line 85 of file DoubleAc.h.

85{ return 0.5 * (da - di); }

◆ get_high_limit()

double DoubleAc::get_high_limit ( void  ) const
inline

Definition at line 81 of file DoubleAc.h.

81{ return da; }

◆ get_left_limit()

double DoubleAc::get_left_limit ( void  ) const
inline

Definition at line 78 of file DoubleAc.h.

78{ return di; }

Referenced by operator-(), and sqrt().

◆ get_low_limit()

double DoubleAc::get_low_limit ( void  ) const
inline

Definition at line 77 of file DoubleAc.h.

77{ return di; }

◆ get_max_limit()

double DoubleAc::get_max_limit ( void  ) const
inline

Definition at line 84 of file DoubleAc.h.

84{ return da; }

◆ get_min_limit()

double DoubleAc::get_min_limit ( void  ) const
inline

Definition at line 80 of file DoubleAc.h.

80{ return di; }

◆ get_right_limit()

double DoubleAc::get_right_limit ( void  ) const
inline

Definition at line 82 of file DoubleAc.h.

82{ return da; }

Referenced by operator-(), and sqrt().

◆ left_limit()

double DoubleAc::left_limit ( void  ) const
inline

Definition at line 79 of file DoubleAc.h.

79{ return di; }

Referenced by acos(), asin(), cos(), exp(), fabs(), inverse_DynArr(), inverse_DynArr_prot(), pow(), sin(), and square().

◆ operator double()

DoubleAc::operator double ( void  ) const
inline

Definition at line 75 of file DoubleAc.h.

75{ return d; }

◆ operator*=() [1/5]

DoubleAc & DoubleAc::operator*= ( double  f)
inline

Definition at line 302 of file DoubleAc.h.

302 {
303 d *= f;
304 if (f >= 0.0) {
305 di *= f;
306 da *= f;
307 } else {
308 double ti = da * f;
309 da = di * f;
310 di = ti;
311 }
312 return *this;
313}

◆ operator*=() [2/5]

DoubleAc & DoubleAc::operator*= ( DoubleAc  f)

Definition at line 40 of file DoubleAc.cpp.

40 {
41 mfunnamep("DoubleAc& DoubleAc::operator*=(const DoubleAc& f)");
42#ifdef DEBUG_OPERATOR_MULT_PRINT
43 mcout.precision(17);
44 mcout << "d=" << d << '\n';
45 mcout << "di=" << di << '\n';
46 mcout << "da=" << da << '\n';
47 mcout << "f.d=" << f.d << '\n';
48 mcout << "f.di=" << f.di << '\n';
49 mcout << "f.da=" << f.da << '\n';
50#endif
51#ifndef VISUAL_STUDIO
52 if (std::isnan(di) == 1) di = -DBL_MAX;
53 if (std::isnan(da) == 1) da = DBL_MAX;
54 if (std::isnan(f.di) == 1) f.di = -DBL_MAX;
55 if (std::isnan(f.da) == 1) f.da = DBL_MAX;
56#else
57 if (_isnan(di) == 1) di = -DBL_MAX;
58 if (_isnan(da) == 1) da = DBL_MAX;
59 if (_isnan(f.di) == 1) f.di = -DBL_MAX;
60 if (_isnan(f.da) == 1) f.da = DBL_MAX;
61#endif
62#ifdef POSSIBLE_FAILURE_ISNAN
63 if (!(di < d) && !(di >= d)) di = -DBL_MAX;
64 if (!(da < d) && !(da >= d)) da = DBL_MAX;
65 if (!(f.di < f.d) && !(f.di >= f.d)) f.di = -DBL_MAX;
66 if (!(f.da < f.d) && !(f.da >= f.d)) f.da = DBL_MAX;
67#endif
68#ifdef DEBUG_OPERATOR_MULT
69 DoubleAc temp(*this); // for debug
70#endif
71 d *= f.d;
72 if (di >= 0) {
73 if (f.di >= 0) {
74 di *= f.di;
75 da *= f.da;
76#ifdef DEBUG_OPERATOR_MULT_PRINT
77 mcout << "case 1\n";
78#endif
79 } else if (f.da >= 0) // assumed that f.di < 0
80 {
81 di = f.di * da;
82 da *= f.da;
83#ifdef DEBUG_OPERATOR_MULT_PRINT
84 mcout << "case 2\n";
85#endif
86 } else // assumed that f.da < 0
87 {
88 double ti = da * f.di;
89 da = di * f.da;
90 di = ti;
91#ifdef DEBUG_OPERATOR_MULT_PRINT
92 mcout << "case 3\n";
93#endif
94 }
95 } else if (da >= 0) // assumed that di < 0
96 {
97 if (f.di >= 0) {
98 di *= f.da;
99 da *= f.da;
100#ifdef DEBUG_OPERATOR_MULT_PRINT
101 mcout << "case 4\n";
102#endif
103 } else if (f.da >= 0) {
104 double ti = find_min(di * f.da, da * f.di);
105 da = find_max(di * f.di, da * f.da);
106 di = ti;
107#ifdef DEBUG_OPERATOR_MULT_PRINT
108 mcout << "case 5\n";
109#endif
110 } else {
111 double ti = da * f.di;
112 da = di * f.di;
113 di = ti;
114#ifdef DEBUG_OPERATOR_MULT_PRINT
115 mcout << "case 6\n";
116#endif
117 }
118 } else // assumed that di < 0 and da < 0
119 {
120 if (f.di >= 0) {
121 di *= f.da;
122 da *= f.di;
123#ifdef DEBUG_OPERATOR_MULT_PRINT
124 mcout << "case 7\n";
125#endif
126 } else if (f.da >= 0) {
127 double ti = di * f.da;
128 da = di * f.di;
129 di = ti;
130#ifdef DEBUG_OPERATOR_MULT_PRINT
131 mcout << "case 8\n";
132#endif
133 } else {
134 double ti = da * f.da;
135 da = di * f.di;
136 di = ti;
137#ifdef DEBUG_OPERATOR_MULT_PRINT
138 mcout << "case 8\n";
139#endif
140 }
141 }
142//mcout<<"d="<<d<<'\n';
143//mcout<<"di="<<di<<'\n';
144//mcout<<"da="<<da<<'\n';
145#ifdef CHECK_CORRECTNESS_AT_MULT
146 if (d < di) {
147 if (d - di == 0.0) // strange but at Sc. Linux 4.0 with -O2 this happens
148 goto mend; // but this precation does not cure!
149 funnw.ehdr(mcerr);
150 mcerr << "d < di at the end of computations\n";
151 mcerr << "This number:\n";
152 print(mcerr, 6);
153 mcerr << "Argument:\n";
154 f.print(mcerr, 6);
155 if (d > di) mcerr << "if(d > di) is also positive\n";
156 if (d == di) mcerr << "if(d == di) is also positive\n";
157 Iprintn(mcerr, d - di);
158#ifdef DEBUG_OPERATOR_MULT
159 // for debug:
160 mcerr << "old value:\n";
161 temp.print(mcerr, 6);
162#endif
163 spexit(mcerr);
164 }
165 if (d > da) {
166 if (d == da) // strange but at Sc. Linux 4.0 with O2 this happens
167 goto mend;
168 funnw.ehdr(mcerr);
169 mcerr << "d > di at the end of computations\n";
170 mcerr << "This number:\n";
171 print(mcerr, 6);
172 mcerr << "Argument:\n";
173 f.print(mcerr, 6);
174 if (d < da) mcerr << "if(d < da) is also positive\n";
175 if (d == da) mcerr << "if(d == da) is also positive\n";
176 Iprintn(mcerr, d - da);
177#ifdef DEBUG_OPERATOR_MULT
178 // for debug:
179 mcerr << "old value:\n";
180 temp.print(mcerr, 6);
181#endif
182 spexit(mcerr);
183 }
184mend:
185#endif
186 return *this;
187}
DoubleAc find_min(const DoubleAc &a, const DoubleAc &b)
Definition: DoubleAc.h:627
DoubleAc find_max(const DoubleAc &a, const DoubleAc &b)
Definition: DoubleAc.h:655
#define mfunnamep(string)
Definition: FunNameStack.h:77
#define spexit(stream)
Definition: FunNameStack.h:536
void print(std::ostream &file, int l=1) const
Definition: DoubleAc.cpp:508
#define mcout
Definition: prstream.h:133
#define Iprintn(file, name)
Definition: prstream.h:216

◆ operator*=() [3/5]

DoubleAc & DoubleAc::operator*= ( float  f)
inline

Definition at line 314 of file DoubleAc.h.

314 {
315 d *= f;
316 if (f >= 0.0) {
317 di *= f;
318 da *= f;
319 } else {
320 double ti = da * f;
321 da = di * f;
322 di = ti;
323 }
324 return *this;
325}

◆ operator*=() [4/5]

DoubleAc & DoubleAc::operator*= ( int  f)
inline

Definition at line 338 of file DoubleAc.h.

338 {
339 d *= f;
340 if (f >= 0.0) {
341 di *= f;
342 da *= f;
343 } else {
344 double ti = da * f;
345 da = di * f;
346 di = ti;
347 }
348 return *this;
349}

◆ operator*=() [5/5]

DoubleAc & DoubleAc::operator*= ( long  f)
inline

Definition at line 326 of file DoubleAc.h.

326 {
327 d *= f;
328 if (f >= 0.0) {
329 di *= f;
330 da *= f;
331 } else {
332 double ti = da * f;
333 da = di * f;
334 di = ti;
335 }
336 return *this;
337}

◆ operator+=() [1/5]

DoubleAc & DoubleAc::operator+= ( const DoubleAc f)
inline

Definition at line 244 of file DoubleAc.h.

244 {
245 di += f.di;
246 d += f.d;
247 da += f.da;
248 return *this;
249}

◆ operator+=() [2/5]

DoubleAc & DoubleAc::operator+= ( double  f)
inline

Definition at line 250 of file DoubleAc.h.

250 {
251 *this += DoubleAc(f);
252 return *this;
253}
DoubleAc(void)
Definition: DoubleAc.h:49

◆ operator+=() [3/5]

DoubleAc & DoubleAc::operator+= ( float  f)
inline

Definition at line 255 of file DoubleAc.h.

255 {
256 *this += DoubleAc(f);
257 return *this;
258}

◆ operator+=() [4/5]

DoubleAc & DoubleAc::operator+= ( int  f)
inline

Definition at line 266 of file DoubleAc.h.

266 {
267 di += f;
268 d += f;
269 da += f;
270 return *this;
271}

◆ operator+=() [5/5]

DoubleAc & DoubleAc::operator+= ( long  f)
inline

Definition at line 260 of file DoubleAc.h.

260 {
261 di += f;
262 d += f;
263 da += f;
264 return *this;
265}

◆ operator-=() [1/5]

DoubleAc & DoubleAc::operator-= ( const DoubleAc f)
inline

Definition at line 273 of file DoubleAc.h.

273 {
274 di -= f.da;
275 d -= f.d;
276 da -= f.di;
277 return *this;
278}

◆ operator-=() [2/5]

DoubleAc & DoubleAc::operator-= ( double  f)
inline

Definition at line 279 of file DoubleAc.h.

279 {
280 *this -= DoubleAc(f);
281 return *this;
282}

◆ operator-=() [3/5]

DoubleAc & DoubleAc::operator-= ( float  f)
inline

Definition at line 284 of file DoubleAc.h.

284 {
285 *this -= DoubleAc(f);
286 return *this;
287}

◆ operator-=() [4/5]

DoubleAc & DoubleAc::operator-= ( int  f)
inline

Definition at line 295 of file DoubleAc.h.

295 {
296 di -= f;
297 d -= f;
298 da -= f;
299 return *this;
300}

◆ operator-=() [5/5]

DoubleAc & DoubleAc::operator-= ( long  f)
inline

Definition at line 289 of file DoubleAc.h.

289 {
290 di -= f;
291 d -= f;
292 da -= f;
293 return *this;
294}

◆ operator/=() [1/5]

DoubleAc & DoubleAc::operator/= ( double  f)
inline

Definition at line 351 of file DoubleAc.h.

351 {
352 if (f == 0.0) {
353 mcerr << "inline DoubleAc& DoubleAc::operator/=(double f):\n"
354 << "f = 0.0\n";
355 spexit(mcerr);
356 }
357 d /= f;
358 if (f >= 0.0) {
359 di /= f;
360 da /= f;
361 } else {
362 double ti = da / f;
363 da = di / f;
364 di = ti;
365 }
366 return *this;
367}

◆ operator/=() [2/5]

DoubleAc & DoubleAc::operator/= ( DoubleAc  f)

Definition at line 189 of file DoubleAc.cpp.

189 {
190 mfunnamep("DoubleAc& DoubleAc::operator/=(const DoubleAc& f)");
191 check_econd11(f.d, == 0, mcerr);
192 check_econd11(f.d, == 0.0, mcerr);
193#ifndef VISUAL_STUDIO
194 if (std::isnan(di) == 1) di = -DBL_MAX;
195 if (std::isnan(da) == 1) da = DBL_MAX;
196 if (std::isnan(f.di) == 1) f.di = -DBL_MAX;
197 if (std::isnan(f.da) == 1) f.da = DBL_MAX;
198#else
199 if (_isnan(di) == 1) di = -DBL_MAX;
200 if (_isnan(da) == 1) da = DBL_MAX;
201 if (_isnan(f.di) == 1) f.di = -DBL_MAX;
202 if (_isnan(f.da) == 1) f.da = DBL_MAX;
203#endif
204#ifdef POSSIBLE_FAILURE_ISNAN
205 if (!(di < d) && !(di >= d)) di = -DBL_MAX;
206 if (!(da < d) && !(da >= d)) da = DBL_MAX;
207 if (!(f.di < f.d) && !(f.di >= f.d)) f.di = -DBL_MAX;
208 if (!(f.da < f.d) && !(f.da >= f.d)) f.da = DBL_MAX;
209#endif
210
211 d /= f.d;
212 if (f.di < 0 && f.da > 0) {
213 di = -DBL_MAX;
214 da = DBL_MAX;
215 } else if (di >= 0) {
216 if (f.di > 0) {
217 di /= f.da;
218 da /= f.di;
219 } else if (f.di == 0) {
220 di /= f.da;
221 da = DBL_MAX;
222 } else {
223 if (f.da == 0) {
224 da = di / f.di;
225 di = -DBL_MAX;
226 } else {
227 double ti = da / f.da;
228 //mcout<<"d="<<d<<" ti="<<ti<<'\n';
229 da = di / f.di;
230 di = ti;
231 }
232 }
233 } else if (da >= 0) {
234 if (f.di > 0) {
235 di /= f.di;
236 da /= f.di;
237 } else if (f.di == 0) {
238 di = -DBL_MAX;
239 da = DBL_MAX;
240 } else {
241 if (f.da == 0) {
242 da = DBL_MAX;
243 di = -DBL_MAX;
244 } else {
245 double ti = da / f.da;
246 da = di / f.da;
247 di = ti;
248 }
249 }
250 } else {
251 // assumed da < 0
252 if (f.di > 0) {
253 di /= f.di;
254 da /= f.da;
255 } else if (f.di == 0) {
256 di = -DBL_MAX;
257 //check_econd11(f.da , == 0 , mcerr); // otherwise f.d == 0 which
258 // was already rejected
259 if (f.da == 0) {
260 funnw.ehdr(mcerr);
261 mcerr << "f.da == 0\n";
262 mcerr << "This means that f.d == 0 which should been already "
263 << "rejected.\n";
264 mcerr << "If the program reaches this point, this means that\n"
265 << "f.d is not between f.di and f.da, which is prohibited\n";
266 mcerr << "f :\n";
267 f.print(mcerr, 6);
268 spexit(mcerr);
269 }
270 da /= f.da;
271 } else {
272 if (f.da == 0) {
273 di = da / f.di;
274 da = DBL_MAX;
275 } else {
276 double ti = da / f.di;
277 da = di / f.da;
278 di = ti;
279 }
280 }
281 }
282#ifdef CHECK_CORRECTNESS_AT_MULT
283 if (d < di) {
284 funnw.ehdr(mcerr);
285 mcerr << "d < di at the end of computations\n";
286 mcerr << "This number:\n";
287 print(mcerr, 6);
288 mcerr << "Argument:\n";
289 f.print(mcerr, 6);
290 // for debug:
291 //mcerr<<"old value:\n";
292 //temp.print(mcerr, 6);
293 spexit(mcerr);
294 }
295 if (d > da) {
296 funnw.ehdr(mcerr);
297 mcerr << "d > di at the end of computations\n";
298 mcerr << "This number:\n";
299 print(mcerr, 6);
300 mcerr << "Argument:\n";
301 f.print(mcerr, 6);
302 // for debug:
303 //mcerr<<"old value:\n";
304 //temp.print(mcerr, 6);
305 spexit(mcerr);
306 }
307#endif
308 //check_econd12(d , < , di , mcerr);
309 //check_econd12(d , > , da , mcerr);
310 return *this;
311}

◆ operator/=() [3/5]

DoubleAc & DoubleAc::operator/= ( float  f)
inline

Definition at line 368 of file DoubleAc.h.

368 {
369 if (f == 0.0) {
370 mcerr << "inline DoubleAc& DoubleAc::operator/=(float f):\n"
371 << "f = 0.0\n";
372 spexit(mcerr);
373 }
374 d /= f;
375 if (f >= 0.0) {
376 di /= f;
377 da /= f;
378 } else {
379 double ti = da / f;
380 da = di / f;
381 di = ti;
382 }
383 return *this;
384}

◆ operator/=() [4/5]

DoubleAc & DoubleAc::operator/= ( int  f)
inline

Definition at line 402 of file DoubleAc.h.

402 {
403 if (f == 0) {
404 mcerr << "inline DoubleAc& DoubleAc::operator/=(int f):\n"
405 << "f = 0\n";
406 spexit(mcerr);
407 }
408 d /= f;
409 if (f >= 0.0) {
410 di /= f;
411 da /= f;
412 } else {
413 double ti = da / f;
414 da = di / f;
415 di = ti;
416 }
417 return *this;
418}

◆ operator/=() [5/5]

DoubleAc & DoubleAc::operator/= ( long  f)
inline

Definition at line 385 of file DoubleAc.h.

385 {
386 if (f == 0) {
387 mcerr << "inline DoubleAc& DoubleAc::operator/=(long f):\n"
388 << "f = 0\n";
389 spexit(mcerr);
390 }
391 d /= f;
392 if (f >= 0.0) {
393 di /= f;
394 da /= f;
395 } else {
396 double ti = da / f;
397 da = di / f;
398 di = ti;
399 }
400 return *this;
401}

◆ operator=() [1/5]

DoubleAc & DoubleAc::operator= ( const DoubleAc f)
inline

Definition at line 65 of file DoubleAc.h.

65 {
66 d = f.d;
67 di = f.di;
68 da = f.da;
69 return *this;
70 }

◆ operator=() [2/5]

DoubleAc & DoubleAc::operator= ( double  f)
inline

Definition at line 161 of file DoubleAc.h.

161 {
162 d = f;
163 if (f == 0.0) {
164 di = 0.0;
165 da = 0.0;
166 } else {
167 if (f > 0.0) {
168 if (f < DBL_MAX / one_plus_def_dbl_prec)
169 da = f * one_plus_def_dbl_prec;
170 else
171 da = f;
172 if (f > DBL_MIN * one_plus_def_dbl_prec)
173 di = f / one_plus_def_dbl_prec;
174 else
175 di = f;
176 } else {
177 if (-f < DBL_MAX / one_plus_def_dbl_prec)
178 di = f * one_plus_def_dbl_prec;
179 else
180 di = f;
181 if (-f > DBL_MIN * one_plus_def_dbl_prec)
182 da = f / one_plus_def_dbl_prec;
183 else
184 da = f;
185 }
186 }
187 return *this;
188}

◆ operator=() [3/5]

DoubleAc & DoubleAc::operator= ( float  f)
inline

Definition at line 204 of file DoubleAc.h.

204 {
205 d = f;
206 if (f == 0.0) {
207 di = 0.0;
208 da = 0.0;
209 } else if (f > 0.0) {
210 di = f * one_minus_def_flt_prec;
211 da = f * one_plus_def_flt_prec;
212 } else {
213 da = f * one_minus_def_flt_prec;
214 di = f * one_plus_def_flt_prec;
215 }
216 return *this;
217}

◆ operator=() [4/5]

DoubleAc & DoubleAc::operator= ( int  f)
inline

Definition at line 237 of file DoubleAc.h.

237 {
238 d = f;
239 di = f;
240 da = f;
241 return *this;
242}

◆ operator=() [5/5]

DoubleAc & DoubleAc::operator= ( long  f)
inline

Definition at line 225 of file DoubleAc.h.

225 {
226 d = f;
227 di = f;
228 da = f;
229 return *this;
230}

◆ print()

void DoubleAc::print ( std::ostream &  file,
int  l = 1 
) const

Definition at line 508 of file DoubleAc.cpp.

508 {
509 if (l <= 0) return;
510 if (l == 1) {
511 file << d;
512 } else if (l == 2) {
513 file << d << " [ " << di << " , " << da << " ] ";
514 } else if (l == 3) {
515 file << d;
516 int t = file.precision(2);
517 file << " [" << std::setw(8) << d - di << "," << std::setw(8) << da - d
518 << "] ";
519 file.precision(t);
520 } else if (l == 4) {
521 file << d << " [ " << di << " , " << da << " ] \n";
522 } else if (l == 5) {
523 file << d;
524 int t = file.precision(2);
525 file << " [" << std::setw(8) << d - di << "," << std::setw(8) << da - d
526 << "] \n";
527 file.precision(t);
528 } else {
529 int t = file.precision(16);
530 file << "DoubleAc: d=" << std::setw(20) << d << " di=" << std::setw(20)
531 << di << " da=" << std::setw(20) << da << '\n';
532 file.precision(t);
533 }
534}

Referenced by operator*=(), operator/=(), and operator<<().

◆ right_limit()

double DoubleAc::right_limit ( void  ) const
inline

Definition at line 83 of file DoubleAc.h.

83{ return da; }

Referenced by acos(), asin(), cos(), exp(), fabs(), pow(), sin(), and square().

Friends And Related Function Documentation

◆ change_sign

void change_sign ( DoubleAc f)
friend

Definition at line 425 of file DoubleAc.h.

425 {
426 f.d = -f.d;
427 double temp = f.di;
428 f.di = -f.da;
429 f.da = -temp;
430}

The documentation for this class was generated from the following files: