Package jmathexpr.arithmetic.integer.impl

Examples of jmathexpr.arithmetic.integer.impl.LongIntegerNumber


        return Long.toString(value);
    }

    @Override
    public IntegerNumber negate() {
        return new LongIntegerNumber(-value);
    }
View Full Code Here


            LongNaturalNumber rhs = (LongNaturalNumber) subtrahend;

            if (value >= rhs.value) {
                return new LongNaturalNumber(value - rhs.value);
            } else {
                return new LongIntegerNumber(value - rhs.value);
            }
        } else {
            return Numbers.subtract(this, subtrahend);
        }
    }
View Full Code Here

        }
    }

    @Override
    public IntegerNumber mod(NaturalNumber modulus) {
        return new LongIntegerNumber(value % ((LongNaturalNumber) modulus).value);
    }
View Full Code Here

        return new LongRationalNumber(value, 1);
    }

    @Override
    public IntegerNumber toInteger() {
        return new LongIntegerNumber(value);
    }
View Full Code Here

    @Override
    public RationalNumber evaluate() {
        LongRationalNumber simplified = simplify();
       
        if (simplified.denominator == 1) {
            return new LongIntegerNumber(simplified.numerator);
        }
        else {
            return simplified;
        }
    }
View Full Code Here

        }
    }
   
    @Override
    public LongIntegerNumber numerator() {
        return new LongIntegerNumber(numerator);
    }
View Full Code Here

    @Override
    public ANumber pow(ANumber exponent) {
        if (exponent instanceof NaturalNumber) {
            LongRationalNumber simplified = simplify();
            LongRationalNumber pown =
                    (LongRationalNumber) new LongIntegerNumber(simplified.numerator).pow(exponent).toRational();
            LongRationalNumber powd =
                    (LongRationalNumber) new LongIntegerNumber(simplified.denominator).pow(exponent).toRational();
           
            return new LongRationalNumber(pown.numerator, powd.numerator);
        } else {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
View Full Code Here

TOP

Related Classes of jmathexpr.arithmetic.integer.impl.LongIntegerNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.