Function necsim::doubleCompare(double, double, double)

Function Documentation

bool necsim::doubleCompare(double d1, double d2, double epsilon)

Compares two doubles and returns a boolean of whether they are equal, within the epsilon deviation. This is useful for floating point errors in saving and reading doubles from file.

true if the doubles are within epsilon of each other
  • d1: the first double.
  • d2: the second double.
  • epsilon: the deviation within which the values are assumed to be equal.