iris icon indicating copy to clipboard operation
iris copied to clipboard

Create an `ApproxConstraint` class

Open trexfeathers opened this issue 1 year ago • 2 comments

Would solve the problem with floating points.

Could also consider a tolerance argument for Constraint, but there could be clashes with actual variable names.

Team have discussed an alternative API something like ApproxConstraint, which explicitly handles the floating point cases.

  • Slower, easier version: convert the Constraint into a range function Constraint
  • Faster, trickier version: work out what the actual floating point representation of the provided number should be, accounting for the type of the coordinate in question, then use that value in the Constraint instead.

Originally posted by @trexfeathers in https://github.com/SciTools/iris/discussions/4744#discussioncomment-2774618

trexfeathers avatar Jan 03 '24 10:01 trexfeathers

If this does happen, a hypothetical Iris 4 could have this as the default behaviour, and the current strict handling for floating points be a 'StrictConstraint' instead.

acchamber avatar Jan 04 '24 12:01 acchamber