Created
November 8, 2018 15:30
-
-
Save Wooder/f74bc827bfe9f18b50bdf2be8721a5c0 to your computer and use it in GitHub Desktop.
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
extension Int { | |
init?(doubleVal: Doube) { | |
guard (doubleVal <= Double(Int.max).nextDown) && (doubleVal >= Double(Int.min).nextUp) else { | |
return nil | |
} | |
self.init(doubleVal) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment