RosettaCodeData/Task/Detect-division-by-zero/Groovy/detect-division-by-zero-1.groovy
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

4 lines
160 B
Groovy

def dividesByZero = { double n, double d ->
assert ! n.infinite : 'Algorithm fails if the numerator is already infinite.'
(n/d).infinite || (n/d).naN
}