コード例 #1
0
        // The standard CLR double.IsNaN() function is approximately 100 times slower than our own wrapper,
        // so please make sure to use DoubleUtil.IsNaN() in performance sensitive code.
        // PS item that tracks the CLR improvement is DevDiv Schedule : 26916.
        // IEEE 754 : If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL
        // or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result will be NaN.
        public static bool IsNaN(double value)
        {
            NanUnion t = new NanUnion();

            t.DoubleValue = value; UInt64 exp = t.UintValue & 0xfff0000000000000;
            UInt64 man = t.UintValue & 0x000fffffffffffff; return((exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0));
        }
コード例 #2
0
        public static bool IsNaN(double value)
        {
            var t = new NanUnion {
                DoubleValue = value
            };
            var exp = t.UintValue & 0xfff0000000000000;
            var man = t.UintValue & 0x000fffffffffffff;

            return((exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0));
        }
コード例 #3
0
        public static bool IsNaN(double value)
        {
            var t = new NanUnion {
                DoubleValue = value
            };
            var exp = t.UlongValue & 0xfff0000000000000;
            var man = t.UlongValue & 0x000fffffffffffff;

            return(exp is 0x7ff0000000000000 or 0xfff0000000000000 && man != 0);
        }
コード例 #4
0
        public static bool IsNaN(double value)
        {
            NanUnion nanUnion = default(NanUnion);

            nanUnion.DoubleValue = value;
            ulong num  = nanUnion.UintValue & 18442240474082181120uL;
            ulong num2 = nanUnion.UintValue & 4503599627370495uL;

            return((num == 9218868437227405312uL || num == 18442240474082181120uL) && num2 != 0uL);
        }
コード例 #5
0
ファイル: DoubleUtil.cs プロジェクト: Master-MiShutka/TMPApps
        // The standard CLR double.IsNaN() function is approximately 100 times slower than our own wrapper,
        // so please make sure to use DoubleUtil.IsNaN() in performance sensitive code.
        // PS item that tracks the CLR improvement is DevDiv Schedule : 26916.
        // IEEE 754 : If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL
        // or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result will be NaN.
        public static bool IsNaN(double value)
        {
            var t = new NanUnion();

            t.DoubleValue = value;

            ulong exp = t.UintValue & 0xfff0000000000000;
            ulong man = t.UintValue & 0x000fffffffffffff;

            return((exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0));
        }
コード例 #6
0
 /// <summary>
 /// Gets whether value is not an number.
 /// </summary>
 /// <param name="value">value to test</param>
 /// <returns>true if value is not an number</returns>
 public static bool IsNaN(double value)
 {
     NanUnion union = new NanUnion();
     union.DoubleValue = value;
     ulong num = union.UintValue & 18442240474082181120L;
     ulong num2 = union.UintValue & ((ulong)0xfffffffffffffL);
     if ((num != 0x7ff0000000000000L) && (num != 18442240474082181120L))
     {
         return false;
     }
     return (num2 != 0L);
 }
コード例 #7
0
        /// <summary>
        /// Indicates whether the value is not a number.
        /// </summary>
        public static bool IsNaN(double value)
        {
            NanUnion t = new NanUnion
            {
                DoubleValue = value
            };

            ulong exp = t.UintValue & 0xfff0000000000000;
            ulong man = t.UintValue & 0x000fffffffffffff;

            return((exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && man != 0);
        }
コード例 #8
0
ファイル: DoubleHelper.cs プロジェクト: kouweizhong/GraphX
        public static bool IsNaN( double value )
        {
            // used reflector to borrow the high performance IsNan function
              // from the WPF MS.Internal namespace
              NanUnion t = new NanUnion();
              t.DoubleValue = value;

              UInt64 exp = t.UintValue & 0xfff0000000000000;
              UInt64 man = t.UintValue & 0x000fffffffffffff;

              return ( exp == 0x7ff0000000000000 || exp == 0xfff0000000000000 ) && ( man != 0 );
        }
コード例 #9
0
ファイル: DoubleHelper.cs プロジェクト: waffle-iron/nequeo
        public static bool IsNaN(double value)
        {
            // used reflector to borrow the high performance IsNan function
            // from the WPF MS.Internal namespace
            NanUnion t = new NanUnion();

            t.DoubleValue = value;

            UInt64 exp = t.UintValue & 0xfff0000000000000;
            UInt64 man = t.UintValue & 0x000fffffffffffff;

            return((exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0));
        }
コード例 #10
0
        public static bool IsNaN(double value)
        {
            NanUnion union = new NanUnion();

            union.DoubleValue = value;
            ulong num  = union.UintValue & 18442240474082181120L;
            ulong num2 = union.UintValue & ((ulong)0xfffffffffffffL);

            if ((num != 0x7ff0000000000000L) && (num != 18442240474082181120L))
            {
                return(false);
            }
            return(num2 != 0L);
        }
コード例 #11
0
        public static bool IsNaN(double value)
        {
            NanUnion nanUnion = new NanUnion();

            nanUnion.DoubleValue = value;
            ulong num1 = nanUnion.UintValue & 18442240474082181120UL;
            ulong num2 = nanUnion.UintValue & 4503599627370495UL;

            if ((long)num1 == 9218868437227405312L || (long)num1 == -4503599627370496L)
            {
                return(num2 > 0UL);
            }
            return(false);
        }
コード例 #12
0
        public static bool IsNaN(double value)
        {
            NanUnion nanUnion = default(NanUnion);

            nanUnion.DoubleValue = value;
            ulong num  = (ulong)((long)nanUnion.UintValue & -4503599627370496L);
            ulong num2 = nanUnion.UintValue & 0xFFFFFFFFFFFFF;

            if (num == 9218868437227405312L || num == 18442240474082181120uL)
            {
                return(num2 != 0);
            }
            return(false);
        }
コード例 #13
0
        /// <summary>
        /// Check if a number isn't really a number.
        /// </summary>
        /// <param name="value">The number to check.</param>
        /// <returns>
        /// True if the number is not a number, false if it is a number.
        /// </returns>
        public static bool IsNaN(this double value)
        {
            // Get the double as an unsigned long
            NanUnion union = new NanUnion { FloatingValue = value };

            // An IEEE 754 double precision floating point number is NaN if its
            // exponent equals 2047 and it has a non-zero mantissa.
            ulong exponent = union.IntegerValue & 0xfff0000000000000L;
            if ((exponent != 0x7ff0000000000000L) && (exponent != 0xfff0000000000000L))
            {
                return false;
            }
            ulong mantissa = union.IntegerValue & 0x000fffffffffffffL;
            return mantissa != 0L;
        }
コード例 #14
0
            internal static bool IsNaN(double value)
            {
                var union = new NanUnion
                {
                    DoubleValue = value
                };
                ulong num  = union.UintValue & 18442240474082181120L;
                ulong num2 = union.UintValue & (0xfffffffffffffL);

                if ((num != 0x7ff0000000000000L) && (num != 18442240474082181120L))
                {
                    return(false);
                }
                return(num2 != 0L);
            }
コード例 #15
0
ファイル: WrapPanel.cs プロジェクト: FgoDt/AcFunVideo
        /// <summary>
        /// Check if a number isn't really a number.
        /// </summary>
        /// <param name="value">The number to check.</param>
        /// <returns>
        /// True if the number is not a number, false if it is a number.
        /// </returns>
        public static bool IsNaN(this double value)
        {
            // Get the double as an unsigned long
            NanUnion union = new NanUnion {FloatingValue = value};

            // An IEEE 754 double precision floating point number is NaN if its
            // exponent equals 2047 and it has a non-zero mantissa.
            ulong exponent = union.IntegerValue & 0xfff0000000000000L;
            if ((exponent != 0x7ff0000000000000L) && (exponent != 0xfff0000000000000L))
            {
                return false;
            }
            ulong mantissa = union.IntegerValue & 0x000fffffffffffffL;
            return mantissa != 0L;
        }
コード例 #16
0
        public static bool IsNaN(this double value)
        {
            var nanUnion = new NanUnion
            {
                FloatingValue = value
            };

            var  num = nanUnion.IntegerValue & 18442240474082181120uL;
            bool result;

            if (num != 9218868437227405312uL && num != 18442240474082181120uL)
            {
                result = false;
            }
            else
            {
                var num2 = nanUnion.IntegerValue & 4503599627370495uL;
                result = (num2 != 0uL);
            }

            return(result);
        }
コード例 #17
0
ファイル: DoubleUtil.cs プロジェクト: inexorabletash/PDFsharp
    /// <summary>
    /// Indicates whether the value is not a number.
    /// </summary>
    public static bool IsNaN(double value)
    {
      NanUnion t = new NanUnion();
      t.DoubleValue = value;

      UInt64 exp = t.UintValue & 0xfff0000000000000;
      UInt64 man = t.UintValue & 0x000fffffffffffff;

      return (exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0);
    }
コード例 #18
0
        /// <summary>
        /// Faster check for NaN ( faster than double.IsNaN() )
        /// IEEE 754 : If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL 
        /// or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result will be NaN.
        /// </summary>
        /// <param name="value">Value to check</param>
        /// <returns></returns>
        public static bool IsNaN(double value)
        {
            var t = new NanUnion
            {
                DoubleValue = value
            };

            var exp = t.UintValue & 0xfff0000000000000;
            var man = t.UintValue & 0x000fffffffffffff;

            return (exp == 0x7ff0000000000000 || exp == 0xfff0000000000000) && (man != 0);
        }