number = (1/0.to_f) #will not error number = 0 unless 1<=>number # will return nil if its infinity or NaN