Skip to content

Instantly share code, notes, and snippets.

@0racle
Created October 9, 2019 01:25
Error Margin
role ErrorMargin[$e] {
method ACCEPTS($lval) { $lval ~~ self - $e .. self + $e }
}
say 2.2 ~~ 2 but ErrorMargin[0.5]; # True
say 2.7 ~~ 2 but ErrorMargin[0.5]; # False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment