expecto
expecto copied to clipboard
Add new more generic version of close in Expect
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
Would love to do a PR for something like this if it would be helpful.
@rahicks26 Yes it would be helpful. :)
Awesome I did a bit of a POC Friday. Should have a PR up around the end of this week.