LessThanOrClose() 공개 정적인 메소드

LessThanOrClose - Returns whether or not the first double is less than or close to the second double. That is, whether or not the first is strictly less than or within epsilon of the other number. Note that this epsilon is proportional to the numbers themselves to that AreClose survives scalar multiplication. Note, There are plenty of ways for this to return false even for numbers which are theoretically identical, so no code calling this should fail to work if this returns false. This is important enough to repeat: NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be used for optimizations *only*.
public static LessThanOrClose ( double value1, double value2 ) : bool
value1 double The first double to compare.
value2 double The second double to compare.
리턴 bool
 public static bool IsBetweenZeroAndOne(double val)
 {
     if (DoubleUtil.GreaterThanOrClose(val, 0.0))
     {
         return(DoubleUtil.LessThanOrClose(val, 1.0));
     }
     return(false);
 }
예제 #2
0
        /// <summary>
        /// Creates an instances of <see cref="DpiScale2"/> from PPI values.
        /// </summary>
        /// <param name="ppiX">PPI along X-axis</param>
        /// <param name="ppiY">PPI along Y-axis</param>
        /// <returns>A new <see cref="DpiScale2"/> instance</returns>
        internal static DpiScale2 FromPixelsPerInch(double ppiX, double ppiY)
        {
            if (DoubleUtil.LessThanOrClose(ppiX, 0) || DoubleUtil.LessThanOrClose(ppiY, 0))
            {
                return(null);
            }

            return(new DpiScale2(ppiX / DpiUtil.DefaultPixelsPerInch, ppiY / DpiUtil.DefaultPixelsPerInch));
        }