-
-
Save chris-taylor/41384441e01df1f88706 to your computer and use it in GitHub Desktop.
alternate definitions of abs and signum
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
myabs x | x > 0 = x | |
| x == 0 = 0 | |
| x < 0 = -x | |
mysignum x | x > 0 = 1 | |
| x == 0 = 0 | |
| x < 0 = -1 | |
test x = myabs x * mysignum x == x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment