Пример #1
0
        /// <summary>
        /// Mathematical modulus operator between this XSFloat and the supplied
        /// ResultSequence. Due to no numeric type promotion or conversion, the
        /// ResultSequence must be of type XSFloat.
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence to perform a modulus with </param>
        /// <returns> A XSFloat consisting of the result of the mathematical modulus. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence mod(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence mod(ResultSequence arg)
        {
            ResultSequence carg = convertResultSequence(arg);
            XSFloat        val  = (XSFloat)get_single_type(carg, typeof(XSFloat));

            return(ResultSequenceFactory.create_new(new XSFloat(float_value() % val.float_value())));
        }
Пример #2
0
        /// <summary>
        /// Mathematical integer division operator between this XSFloat and the
        /// supplied ResultSequence.
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence to perform an integer division with </param>
        /// <returns> A XSInteger consisting of the result of the mathematical integer
        ///         division. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence idiv(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence idiv(ResultSequence arg)
        {
            ResultSequence carg = convertResultSequence(arg);
            XSFloat        val  = (XSFloat)get_single_type(carg, typeof(XSFloat));

            if (this.nan() || val.nan())
            {
                throw DynamicError.numeric_overflow("Dividend or divisor is NaN");
            }

            if (this.infinite())
            {
                throw DynamicError.numeric_overflow("Dividend is infinite");
            }

            if (val.zero())
            {
                throw DynamicError.div_zero(null);
            }

            decimal result = (decimal)(
                (double)
                (float_value() / val.float_value())
                );

            return(ResultSequenceFactory.create_new(new XSInteger(new BigInteger(result))));
        }
Пример #3
0
        /// <summary>
        /// Comparison between this number and the supplied representation.
        /// </summary>
        /// <param name="arg">
        ///            The datatype to compare with </param>
        /// <returns> True if the supplied representation is a greater number than the
        ///         one stored. False otherwise </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override bool lt(AnyType arg, DynamicContext context)
        {
            Item    carg = convertArg(arg);
            XSFloat val  = (XSFloat)get_single_type(carg, typeof(XSFloat));

            return(float_value() < val.float_value());
        }
Пример #4
0
        /// <summary>
        /// Mathematical subtraction operator between this XSFloat and the supplied
        /// ResultSequence.
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence to perform a subtraction with </param>
        /// <returns> A XSFloat consisting of the result of the mathematical
        ///         subtraction. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence minus(ResultSequence arg)
        {
            ResultSequence carg = constructor(arg);
            Item           at   = get_single_arg(carg);

            if (!(at is XSFloat))
            {
                DynamicError.throw_type_error();
            }
            XSFloat val = (XSFloat)at;

            return(ResultSequenceFactory.create_new(new XSFloat(float_value() - val.float_value())));
        }
Пример #5
0
        /// <summary>
        /// Equality comparison between this number and the supplied representation. </summary>
        /// <param name="aa">
        ///            The datatype to compare with
        /// </param>
        /// <returns> True if the two representations are of the same number. False
        ///         otherwise </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public boolean eq(AnyType aa, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override bool eq(AnyType aa, DynamicContext dynamicContext)
        {
            Item carg = convertArg(aa);

            if (!(carg is XSFloat))
            {
                DynamicError.throw_type_error();
            }

            XSFloat f = (XSFloat)carg;

            if (nan() && f.nan())
            {
                return(false);
            }

            float?thatvalue = new float?(f.float_value());
            float?thisvalue = new float?(float_value());

            return(thisvalue.Equals(thatvalue));
        }