ANIMA
4.0
src
Anima
math-tools
special_functions
animaLogarithmFunctions.hxx
Go to the documentation of this file.
1
#pragma once
2
#include <cmath>
3
4
namespace
anima
5
{
6
7
template
<
class
ScalarType>
double
safe_log
(
const
ScalarType x)
8
{
9
ScalarType digits = std::numeric_limits<ScalarType>::digits10;
10
11
ScalarType precision = pow(10.0, -digits);
12
13
if
(x < precision)
14
return
std::log(precision);
15
16
return
std::log(x);
17
}
18
19
}
// end of namespace anima
anima::safe_log
double safe_log(const ScalarType x)
Definition:
animaLogarithmFunctions.hxx:7
anima
Definition:
animaDTIEstimationImageFilter.h:7
Generated by
1.8.13