code: def residual_resistance_coef(slenderness, prismatic_coef, froude_number):
      
      Cr = cr(slenderness, prismatic_coef, froude_number)
      if math.isnan(Cr):
          Cr = cr_nearest(slenderness, prismatic_coef, froude_number)
  
      # if Froude number is out of interpolation range, nearest extrapolation is used
      return Cr
docs: Residual resistance coefficient estimation from slenderness function, prismatic coefficient and Froude number.
  
      :param slenderness: Slenderness coefficient dimensionless :math:`L/(∇^{1/3})` where L is length of ship, ∇ is displacement
      :param prismatic_coef: Prismatic coefficient dimensionless :math:`∇/(L\cdot A_m)` where L is length of ship, ∇ is displacement Am is midsection area of the ship
      :param froude_number: Froude number of the ship dimensionless 
      :return: Residual resistance of the ship