Created
May 12, 2016 20:51
-
-
Save haydenholligan/d42d1c362e12fc56d9c3840f630b412b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//Because swift thinks remainder is cooler than modulus | |
func modulus(number: Double, modulo: Double) -> Double { | |
var result = number % modulo | |
if result < 0 { | |
result += modulo | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment