Don't allow floor or ceiling output to be NaN

Don't allow floor or ceiling output to be NaN