Example #1
0
        /// <summary>
        /// Mathematical integer division operator between this XSDouble 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);

            XSDouble val = (XSDouble)get_single_type(carg, typeof(XSDouble));

            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 = new decimal((double_value() / val.double_value()));

            return(ResultSequenceFactory.create_new(new XSInteger(new BigInteger(result))));
        }
Example #2
0
        /// <summary>
        /// Mathematical division operator between this XSDecimal and the supplied
        /// ResultSequence.
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence to perform a division with </param>
        /// <returns> A XSDecimal consisting of the result of the mathematical
        ///         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 div(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence div(ResultSequence arg)
        {
            ResultSequence carg = convertResultSequence(arg);

            XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal));

            if (val.zero())
            {
                throw DynamicError.div_zero(null);
            }
            //decimal result = Value.divide(val.Value, 18, decimal.ROUND_HALF_EVEN);
            //return ResultSequenceFactory.create_new(new XSDecimal(result));
            throw new Exception();
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence div(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence div(ResultSequence arg)
        {
            ResultSequence carg = convertResultSequence(arg);

            XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal));

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

            decimal result = decimal.Divide(Value, val.Value);

            return(ResultSequenceFactory.create_new(new XSDecimal(result)));
        }
Example #4
0
        /// <summary>
        /// Mathematical integer division operator between this XSDecimal and the
        /// supplied ResultSequence. Due to no numeric type promotion or conversion,
        /// the ResultSequence must be of type XSDecimal.
        /// </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);

            XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal));

            if (val.zero())
            {
                throw DynamicError.div_zero(null);
            }
            System.Numerics.BigInteger _ivalue = new BigInteger(_value);
            System.Numerics.BigInteger ival    = new BigInteger(val.Value);
            System.Numerics.BigInteger result  = _ivalue / ival;
            return(ResultSequenceFactory.create_new(new XSInteger(result)));
        }