Example #1
0
 /// <summary>
 /// Returns a value that indicates whether the specified value is not a number (<see cref="NaN"/>).
 /// </summary>
 /// <param name="value">An instance of this class.</param>
 /// <returns><b>true</b> if <paramref name="value"/> evaluates to <see cref="NaN"/>; otherwise, <b>false</b>.</returns>
 public static bool IsNaN(UFloat10 value)
 {
     if ((value.Value & ExponentMask) != ExponentMask)
     {
         return(false);
     }
     return((value.Value & MantissaMask) != 0);
 }
Example #2
0
            /// <summary>
            /// Constructs an instance of this class with the value of the argument.
            /// </summary>
            /// <param name="value">An instance of <see cref="UFloat10"/>.</param>
            public Float16(UFloat10 value)
            {
                int exp = value.Value & UFloat10.ExponentMask;
                int man = value.Value & UFloat10.MantissaMask;

                if (exp == UFloat10.ExponentMask)
                {
                    if (man == 0)
                    {
                        Value = PositiveInfinity;
                    }
                    else
                    {
                        Value = NaN;
                    }
                    return;
                }

                Value = (ushort)((value.Value << 5) & FillMask);
            }
Example #3
0
 /// <summary>
 /// Returns a value indicating whether the specified number evaluates to (positive) infinity.
 /// </summary>
 /// <param name="value">An instance of this class.</param>
 /// <returns><b>true</b> if <paramref name="value"/> evaluates to <see cref="Infinity"/>; otherwise, <b>false</b>.</returns>
 public static bool IsInfinity(UFloat10 value)
 {
     return(value.Value == Infinity);
 }
Example #4
0
 /// <summary>
 /// Constructs an instance of this class with the value of the argument.
 /// </summary>
 /// <param name="value">An instance of this class.</param>
 public UFloat10(UFloat10 value)
 {
     Value = value.Value;
 }