본문 바로가기
.NET C#

경사도

by 태디 2023. 1. 16.
728x90

 

사진출처 : https://www.wired.com/2013/03/whats-the-steepest-gradient-for-a-road-bike/

 

   public static double Grade(double gap, double distance)
   {
       double rtnGrade = 0.0;

       rtnGrade = Math.Round(gap / Math.Sqrt((distance * 1000) * (distance * 1000) - (gap * gap)) * 100, 2);

       return Common.NaNValue(rtnGrade);
   }

 

 public static double NaNValue(double value)
 {
     double rtnValue = !double.IsNaN(value) ? value : 0;
     return rtnValue;
 }

 

댓글