Пример #1
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(UFloat11 value)
 {
     if ((value.Value & ExponentMask) != ExponentMask)
     {
         return(false);
     }
     return((value.Value & MantissaMask) == 0);
 }
Пример #2
0
            /// <summary>
            /// Constructs an instance of this class with the value of the argument.
            /// </summary>
            /// <param name="value">An instance of <see cref="UFloat11"/>.</param>
            public Float16(UFloat11 value)
            {
                int exp = value.Value & UFloat11.ExponentMask;
                int man = value.Value & UFloat11.MantissaMask;

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

                Value = (ushort)((value.Value << 4) & FillMask);
            }
Пример #3
0
            /// <summary>
            /// Constructs an instance of this class with the value of the argument.
            /// </summary>
            /// <param name="value">An instance of <see cref="UFloat11"/>.</param>
            public UFloat10(UFloat11 value)
            {
                int exp = value.Value & UFloat11.ExponentMask;
                int man = value.Value & UFloat11.MantissaMask;

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

                Value = (ushort)(((value.Value >> 1) + (value.Value & 1)) & FillMask);
            }
Пример #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 UFloat11(UFloat11 value)
 {
     Value = value.Value;
 }