Beispiel #1
0
        public bool Equals(CosmosNumber number1, CosmosNumber number2)
        {
            double double1;

            if (number1.IsFloatingPoint)
            {
                double1 = number1.AsFloatingPoint().Value;
            }
            else
            {
                double1 = number1.AsInteger().Value;
            }

            double double2;

            if (number2.IsFloatingPoint)
            {
                double2 = number2.AsFloatingPoint().Value;
            }
            else
            {
                double2 = number2.AsInteger().Value;
            }

            return(double1 == double2);
        }
Beispiel #2
0
        public bool Equals(CosmosNumber number1, CosmosNumber number2)
        {
            if (number1.NumberType != number2.NumberType)
            {
                return(false);
            }
            else if (number1.NumberType == CosmosNumberType.Number64)
            {
                double double1;
                if (number1.IsFloatingPoint)
                {
                    double1 = number1.AsFloatingPoint().Value;
                }
                else
                {
                    double1 = number1.AsInteger().Value;
                }

                double double2;
                if (number2.IsFloatingPoint)
                {
                    double2 = number2.AsFloatingPoint().Value;
                }
                else
                {
                    double2 = number2.AsInteger().Value;
                }

                return(double1 == double2);
            }
            else if (number1.IsFloatingPoint)
            {
                return(number1.AsFloatingPoint() == number2.AsFloatingPoint());
            }
            else
            {
                return(number1.AsInteger() == number2.AsInteger());
            }
        }