expecto icon indicating copy to clipboard operation
expecto copied to clipboard

Add new more generic version of close in Expect

Open rahicks26 opened this issue 4 years ago • 3 comments

Currently, there is easy to check if two floats are close to each other, but it would be nice to add some new methods that extend this method and maybe a few other float specific to work with more types such as decimal and UoMs.

/// Rough v1.  Need to look at the other methods to make it compatible.
let inline close v1 v2 epsilon =
    let diff = (v1 - v2)
    let delta = abs diff
    delta < epsilon

rahicks26 avatar Mar 19 '21 15:03 rahicks26

Would love to do a PR for something like this if it would be helpful.

rahicks26 avatar Mar 19 '21 15:03 rahicks26

@rahicks26 Yes it would be helpful. :)

haf avatar Mar 20 '21 07:03 haf

Awesome I did a bit of a POC Friday. Should have a PR up around the end of this week.

rahicks26 avatar Mar 23 '21 16:03 rahicks26