RosettaCodeData/Task/Detect-division-by-zero/R/detect-division-by-zero.r

5 lines
62 B
R

d <- 5/0
if ( !is.finite(d) ) {
# it is Inf, -Inf, or NaN
}