diff --git a/src/math/FGTable.cpp b/src/math/FGTable.cpp index 62f2ab59b5..c14a1f5927 100644 --- a/src/math/FGTable.cpp +++ b/src/math/FGTable.cpp @@ -509,7 +509,8 @@ double FGTable::GetValue(double key) const double Span = Data[2*r] - x0; assert(Span > 0.0); double Factor = (key - x0) / Span; - assert(Factor >= 0.0 && Factor <= 1.0); + assert(Factor >= -EPSILON && Factor <= 1.0 + EPSILON); + double y0 = Data[2*r-1]; return Factor*(Data[2*r+1] - y0) + y0; diff --git a/src/math/FGTable.h b/src/math/FGTable.h index 1439c69cb7..20905e1eea 100644 --- a/src/math/FGTable.h +++ b/src/math/FGTable.h @@ -313,6 +313,8 @@ class JSBSIM_API FGTable : public FGParameter, public FGJSBBase std::string GetName(void) const {return Name;} + static constexpr double EPSILON = 1e-9; + private: enum type {tt1D, tt2D, tt3D} Type; enum axis {eRow=0, eColumn, eTable};