Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
vfloat.h
Go to the documentation of this file.
1#ifndef VFLOAT_H
2#define VFLOAT_H
3#include <cfloat>
4#ifdef VISUAL_STUDIO
5#define _USE_MATH_DEFINES
6// see comment in math.h:
7/* Define _USE_MATH_DEFINES before including math.h to expose these macro
8 * definitions for common math constants. These are placed under an #ifdef
9 * since these commonly-defined names are not part of the C/C++ standards.
10 */
11#endif
12#include <cmath>
14#define max_vfloat DBL_MAX //1.0E+100 // ??
15typedef double vfloat;
16const vfloat max_safe_vfloat = 0.5 * sqrt(DBL_MAX); //e+307
17const vfloat vprecision = 1.0E-12;
18
19inline vfloat abslt(vfloat f) { return f > 0.0 ? f : -f; }
20
21inline int apeq(vfloat f1, vfloat f2, vfloat prec = vprecision) {
22 if (abslt(f1 - f2) <= prec)
23 return 1;
24 else
25 return 0;
26}
27inline int not_apeq(vfloat f1, vfloat f2, vfloat prec = vprecision) {
28 if (abslt(f1 - f2) <= prec)
29 return 0;
30 else
31 return 1;
32}
33
34namespace Heed {
35inline int apeq(vfloat f1, vfloat f2, vfloat prec = vprecision) {
36 if (abslt(f1 - f2) <= prec)
37 return 1;
38 else
39 return 0;
40}
41inline int not_apeq(vfloat f1, vfloat f2, vfloat prec = vprecision) {
42 if (abslt(f1 - f2) <= prec)
43 return 0;
44 else
45 return 1;
46}
47}
48
49#endif
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
Definition: BGMesh.cpp:3
int apeq(const circumf &f1, const circumf &f2, vfloat prec)
Definition: circumf.cpp:45
int not_apeq(vfloat f1, vfloat f2, vfloat prec=vprecision)
Definition: vfloat.h:41
double vfloat
Definition: vfloat.h:15
vfloat abslt(vfloat f)
Definition: vfloat.h:19
const vfloat vprecision
Definition: vfloat.h:17
int not_apeq(vfloat f1, vfloat f2, vfloat prec=vprecision)
Definition: vfloat.h:27
const vfloat max_safe_vfloat
Definition: vfloat.h:16
int apeq(vfloat f1, vfloat f2, vfloat prec=vprecision)
Definition: vfloat.h:21