Interface IRational

    • Method Detail

      • abs

        IRational abs()
        Get the absolute value for a given number
        Specified by:
        abs in interface edu.jas.structure.AbelianGroupElem<IExpr>
        Specified by:
        abs in interface org.hipparchus.CalculusFieldElement<IExpr>
        Specified by:
        abs in interface IExpr
        Specified by:
        abs in interface INumber
        Specified by:
        abs in interface IReal
      • ceil

        IInteger ceil()
        Specified by:
        ceil in interface org.hipparchus.CalculusFieldElement<IExpr>
        Specified by:
        ceil in interface IExpr
      • checkBitLength

        void checkBitLength()
      • compareInt

        int compareInt​(int value)
      • dec

        IRational dec()
        Description copied from interface: IExpr
        Returns an IExpr whose value is (this - 1). Calculates F.eval(F.Subtract(this, C1)) in the common case and uses a specialized implementation for derived number classes.
        Specified by:
        dec in interface IExpr
        Returns:
      • denominator

        IInteger denominator()
        Returns the denominator of this fraction.
        Returns:
        denominator
      • equalsFraction

        boolean equalsFraction​(int numerator,
                               int denominator)
        Check if this number equals the given fraction numerator/denominator number. GCD(numerator, /denominator) should be 1;
        Parameters:
        numerator - the numerator
        denominator - the denominator
        Returns:
      • factorInteger

        IASTAppendable factorInteger()
        Return the prime factors paired with their exponents for integer and fractional numbers. For factors of the denominator part of fractional numbers the exponents are negative.
         factorInteger(-4) ==> {{-1,1},{2,2}}
         
        Returns:
        the list of prime factors paired with their exponents
      • factorSmallPrimes

        IAST factorSmallPrimes​(int numerator,
                               int root)
        Factor into small factors below 1021 if possible and determine the root.
        Parameters:
        numerator -
        root - the root > 1 which should be determined
        Returns:
        the rest of the factorization
      • floor

        IInteger floor()
        Specified by:
        floor in interface org.hipparchus.CalculusFieldElement<IExpr>
        Specified by:
        floor in interface IExpr
      • gcd

        IRational gcd​(IRational that)
        Compute the gcd of two rationals. The gcd is the rational number, such that dividing this and other with the gcd will yield two co-prime integers.
        Parameters:
        that - the second rational argument.
        Returns:
        the gcd of this and other.
      • getFraction

        @Deprecated
        default org.hipparchus.fraction.BigFraction getFraction()
        Deprecated.
        Returns this number as BigFraction number.
        Returns:
        this number s big fraction.
      • inc

        IRational inc()
        Description copied from interface: IExpr
        Returns an IExpr whose value is (this + 1). Calculates F.eval(F.Plus(this, C1)) in the common case and uses a specialized implementation for derived number classes.
        Specified by:
        inc in interface IExpr
        Returns:
      • inverse

        IRational inverse()
        Returns the multiplicative inverse of this object. It is the object such as this.times(this.inverse()) == ONE , with ONE being the multiplicative identity. Calculates F.eval(F.Power(this, F.CN1)) in the common case and uses a specialized implmentation for derived number classes.
        Specified by:
        inverse in interface IExpr
        Specified by:
        inverse in interface INumber
        Specified by:
        inverse in interface IReal
        Specified by:
        inverse in interface edu.jas.structure.MonoidElem<IExpr>
        Returns:
        ONE / this.
      • mod

        default IRational mod​(IRational m)
        Returns this mod m, a non-negative value less than m. This differs from this % m, which might be negative. For example:
         mod(7, 4) == 3
         mod(-7, 4) == 1
         mod(-1, 4) == 3
         mod(-8, 4) == 0
         mod(8, 4) == 0
         
        Parameters:
        m -
        Returns:
        Throws:
        ArithmeticException - - if m <= 0
      • multiply

        IRational multiply​(int n)
        Specified by:
        multiply in interface org.hipparchus.FieldElement<IExpr>
        Specified by:
        multiply in interface IExpr
      • negate

        IRational negate()
        Description copied from interface: IReal
        Returns (-1) * this
        Specified by:
        negate in interface edu.jas.structure.AbelianGroupElem<IExpr>
        Specified by:
        negate in interface org.hipparchus.FieldElement<IExpr>
        Specified by:
        negate in interface IExpr
        Specified by:
        negate in interface INumber
        Specified by:
        negate in interface IReal
      • normalize

        IRational normalize()
        Return the normalized form of this number (i.e. if the denominator part equals one, return the numerator part as an integer number).
        Returns:
      • numerator

        IInteger numerator()
        Returns the numerator of this fraction.
        Returns:
        numerator
      • roundClosest

        IRational roundClosest​(IReal factor)
        Description copied from interface: IReal
        Round this number to the closest IReal multiple of the factor.
        Specified by:
        roundClosest in interface IReal
        Returns:
        the closest integer to the argument.
      • toBigDenominator

        BigInteger toBigDenominator()
        Returns the denominator of this fraction.
        Returns:
        denominator
      • toBigFraction

        org.hipparchus.fraction.BigFraction toBigFraction()
        Returns this number as BigRational number.
        Returns:
        this number s big fraction.
      • toBigRational

        edu.jas.arith.BigRational toBigRational()
        Returns this number as BigRational number.
        Returns:
        this number s big fraction.
      • toBigNumerator

        BigInteger toBigNumerator()
        Returns the numerator of this fraction.
        Returns:
        denominator
      • trunc

        default IInteger trunc()
        Truncates the integer part in the "direction to 0" as isNegative() ? ceil() : floor() ..
        Returns: