Created
October 9, 2019 01:25
-
-
Save 0racle/c32fc7f9c11d6a0dbe59c9f5cc389611 to your computer and use it in GitHub Desktop.
Error Margin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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