Test to see if a double is a finite number (is not NaN or Infinity).

image_pdfimage_print
   
 

public class MainClass{
        /// <summary>
        /// Test to see if a double is a finite number (is not NaN or Infinity).
        /// </summary>
        /// <param name=&#039;value&#039;>The value to test.</param>
        /// <returns>Whether or not the value is a finite number.</returns>
        public static bool IsFinite(double value)
        {
            return !double.IsNaN(value) &amp;&amp; !double.IsInfinity(value);
        }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.