IsPositiveInfinity() public méthode

Determines if a Fraction represents Positive Infinity
public IsPositiveInfinity ( ) : bool
Résultat bool
Exemple #1
0
        /// <summary>
        /// Determines how this Fraction, of an indeterminate type, compares to another Fraction
        /// </summary>
        /// <param name="leftType">What kind of indeterminate</param>
        /// <param name="right">The other Fraction to compare against</param>
        /// <returns>-1 if this is less than <paramref name="right"></paramref>,
        ///  0 if they are equal,
        ///  1 if this is greater than <paramref name="right"></paramref></returns>
        /// <remarks>NaN is less than anything except NaN and Negative Infinity. Negative Infinity is less
        /// than anything except Negative Infinity. Positive Infinity is greater than anything except
        /// Positive Infinity.</remarks>
        private static int IndeterminantCompare(Indeterminates leftType, Fraction right)
        {
            switch (leftType)
            {
                case Indeterminates.NaN:
                    // A NaN is...
                    if (right.IsNaN())
                        return 0;	// equal to a NaN
                    else if (right.IsNegativeInfinity())
                        return 1;	// great than Negative Infinity
                    else
                        return -1;	// less than anything else

                case Indeterminates.NegativeInfinity:
                    // Negative Infinity is...
                    if (right.IsNegativeInfinity())
                        return 0;	// equal to Negative Infinity
                    else
                        return -1;	// less than anything else

                case Indeterminates.PositiveInfinity:
                    if (right.IsPositiveInfinity())
                        return 0;	// equal to Positive Infinity
                    else
                        return 1;	// greater than anything else

                default:
                    // this CAN'T happen, something VERY wrong is going on...
                    return 0;
            }
        }