OGS
MathLib::Nonlinear::detail Namespace Reference

Functions

bool same_sign (double a, double b)
 Tells if a and b have the same sign.
 
bool almost_zero (double a)
 

Function Documentation

◆ almost_zero()

bool MathLib::Nonlinear::detail::almost_zero ( double a)
inline

Definition at line 38 of file Root1D.h.

39{
40 return std::abs(a) <= std::numeric_limits<double>::epsilon();
41}

Referenced by MathLib::Nonlinear::RegulaFalsi< SubType, Function >::RegulaFalsi(), and MathLib::Nonlinear::RegulaFalsi< SubType, Function >::step().

◆ same_sign()

bool MathLib::Nonlinear::detail::same_sign ( double a,
double b )
inline

Tells if a and b have the same sign.

Definition at line 30 of file Root1D.h.

31{
32 // note: signbit() casts integers to double and distinguishes between +0.0 and
33 // -0.0. However, the latter is not a problem, because if f(x0) == 0, we've
34 // already found the root x0 that we are searching for.
35 return std::signbit(a) == std::signbit(b);
36}

Referenced by MathLib::Nonlinear::RegulaFalsi< SubType, Function >::RegulaFalsi(), and MathLib::Nonlinear::RegulaFalsi< SubType, Function >::step().