Skip to content

Instantly share code, notes, and snippets.

@joanmolinas
Last active August 29, 2015 14:18
Show Gist options
  • Save joanmolinas/045fe0515fe0237fd23e to your computer and use it in GitHub Desktop.
Save joanmolinas/045fe0515fe0237fd23e to your computer and use it in GitHub Desktop.
extension Double {
static var min : Double {
get {
return -2147483648
}
}
static var max : Double {
get {
return 2147483647
}
}
}
let distances = [1.5, 6.3, 8.4, 6.51, 2.65]
let numMax = distances.reduce(Double.min){max($0, $1)}
numMax // OUTPUT -> 8.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment