hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
misc.cc
Go to the documentation of this file.
1
#include "
utils/misc.h
"
2
3
#include <cmath>
4
#include <limits>
5
6
#include "
utils/constants.h
"
7
8
namespace
hummingbird
{
9
bool
DoubleEqual
(
const
double
first,
const
double
second,
10
const
double
tolerance) {
11
double
difference = second - first;
12
return
(std::abs(difference) < tolerance);
13
}
14
15
double
RelativeError
(
const
double
new_val,
const
double
old_val) {
16
if
(new_val == 0.0)
17
return
old_val == 0.0 ? 0.0 : std::numeric_limits<double>::infinity();
18
return
std::abs((new_val - old_val) / new_val);
19
}
20
21
}
// namespace hummingbird
constants.h
misc.h
hummingbird
Definition
bank_base.h:13
hummingbird::DoubleEqual
bool DoubleEqual(const double first, const double second, const double tolerance=TOLERANCE)
Tests if two double-type numbers are equal using the TOLERANCE value. Taken from https://github....
Definition
misc.cc:9
hummingbird::RelativeError
double RelativeError(const double new_val, const double old_val)
Compute the relative error between two values.
Definition
misc.cc:15
src
utils
misc.cc
Generated by
1.17.0