Skip to content

floating point precision of cell squareness #226

Description

@fpirotti

Is it necessary to provide such strict check for cell squareness? Providing in other environments (R) identical resolution in X and Y still gets a difference of 2.415845e-13 which is still higher then epsilon, thus throwing an error. Considering we are working with metric units, would it make more sense to provide a less stringent threshold such as 10e-6 ? I am referring to parts such as the ones below:

double epsilon = std::numeric_limits<double>::epsilon();
  if (fabs(cellSizeX - cellSizeY) > epsilon)
  {
      throw std::runtime_error("Error: Cells are not square in: '" + filename + "'");
  }

would be more practical to convert to :

double epsilon = 0.000001;
  if (fabs(cellSizeX - cellSizeY) > epsilon)
  {
      throw std::runtime_error("Error: Cells are not square in: '" + filename + "'");
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions