Documentation of 'edu.jas.arith.BigDecimal' Java class
BigDecimal
edu.jas.arith

Class BigDecimal

    • Field Detail

      • val

        public final java.math.BigDecimal val
        The data structure.
      • DEFAULT_CONTEXT

        public static final java.math.MathContext DEFAULT_CONTEXT
      • DEFAULT_PRECISION

        public static final int DEFAULT_PRECISION
      • context

        public final java.math.MathContext context
      • ZERO

        public static final BigDecimal ZERO
        The constant 0.
      • ONE

        public static final BigDecimal ONE
        The constant 1.
    • Constructor Detail

      • BigDecimal

        public BigDecimal(java.math.BigDecimal a)
        Constructor for BigDecimal from math.BigDecimal.
        Parameters:
        a - java.math.BigDecimal.
      • BigDecimal

        public BigDecimal(java.math.BigDecimal a,
                          java.math.MathContext mc)
        Constructor for BigDecimal from math.BigDecimal.
        Parameters:
        a - java.math.BigDecimal.
        mc - MathContext.
      • BigDecimal

        public BigDecimal(long a)
        Constructor for BigDecimal from long.
        Parameters:
        a - long.
      • BigDecimal

        public BigDecimal(long a,
                          java.math.MathContext mc)
        Constructor for BigDecimal from long and a context.
        Parameters:
        a - long.
        mc - MathContext.
      • BigDecimal

        public BigDecimal(double a)
        Constructor for BigDecimal from double.
        Parameters:
        a - double.
      • BigDecimal

        public BigDecimal(double a,
                          java.math.MathContext mc)
        Constructor for BigDecimal from double and a context.
        Parameters:
        a - double.
        mc - MathContext.
      • BigDecimal

        public BigDecimal(java.math.BigInteger a)
        Constructor for BigDecimal from java.math.BigInteger.
        Parameters:
        a - java.math.BigInteger.
      • BigDecimal

        public BigDecimal(java.math.BigInteger a,
                          java.math.MathContext mc)
        Constructor for BigDecimal from java.math.BigInteger.
        Parameters:
        a - java.math.BigInteger.
        mc - MathContext.
      • BigDecimal

        public BigDecimal(BigRational a)
        Constructor for BigDecimal from BigRational.
        Parameters:
        a - edu.jas.arith.BigRational.
      • BigDecimal

        public BigDecimal(BigRational a,
                          java.math.MathContext mc)
        Constructor for BigDecimal from BigRational.
        Parameters:
        a - edu.jas.arith.BigRational.
        mc - MathContext.
      • BigDecimal

        public BigDecimal(java.lang.String s)
        Constructor for BigDecimal from String.
        Parameters:
        s - String.
      • BigDecimal

        public BigDecimal(java.lang.String s,
                          java.math.MathContext mc)
        Constructor for BigDecimal from String.
        Parameters:
        s - String.
        mc - MathContext.
      • BigDecimal

        public BigDecimal()
        Constructor for BigDecimal without parameters.
    • Method Detail

      • copy

        public BigDecimal copy()
        Clone this.
        Specified by:
        copy in interface Element<BigDecimal>
        Returns:
        Creates and returns a copy of this Element.
        See Also:
        Object.clone()
      • isAssociative

        public boolean isAssociative()
        Query if this ring is associative. Floating point number addition is not associative, but multiplication is.
        Specified by:
        isAssociative in interface MonoidFactory<BigDecimal>
        Returns:
        true.
      • isField

        public boolean isField()
        Query if this ring is a field.
        Specified by:
        isField in interface RingFactory<BigDecimal>
        Returns:
        true.
      • characteristic

        public java.math.BigInteger characteristic()
        Characteristic of this ring.
        Specified by:
        characteristic in interface RingFactory<BigDecimal>
        Returns:
        characteristic of this ring.
      • fromInteger

        public BigDecimal fromInteger(java.math.BigInteger a)
        Get a BigDecimal element from a math.BigDecimal.
        Specified by:
        fromInteger in interface ElemFactory<BigDecimal>
        Parameters:
        a - math.BigDecimal.
        Returns:
        a as BigDecimal.
      • valueOf

        public static BigDecimal valueOf(java.math.BigDecimal a)
        Get a BigDecimal element from a math.BigDecimal.
        Parameters:
        a - math.BigDecimal.
        Returns:
        a as BigDecimal.
      • valueOf

        public static BigDecimal valueOf(long a)
        Get a BigDecimal element from long.
        Parameters:
        a - long.
        Returns:
        a as BigDecimal.
      • toString

        public java.lang.String toString()
        Get the String representation.
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • toScriptFactory

        public java.lang.String toScriptFactory()
        Get a scripting compatible string representation of the factory.
        Specified by:
        toScriptFactory in interface Element<BigDecimal>
        Returns:
        script compatible representation for this ElemFactory.
        See Also:
        Element.toScriptFactory()
      • compareTo

        public int compareTo(BigDecimal b)
        Compare to BigDecimal b. Experimental, is hacked.
        Specified by:
        compareTo in interface Element<BigDecimal>
        Specified by:
        compareTo in interface java.lang.Comparable<BigDecimal>
        Parameters:
        b - BigDecimal.
        Returns:
        0 if abs(this-b) < epsilon, 1 if this > b, -1 if this < b.
      • equals

        public boolean equals(java.lang.Object b)
        Comparison with any other object.
        Specified by:
        equals in interface Element<BigDecimal>
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to b, else false.
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Hash code for this BigDecimal.
        Specified by:
        hashCode in interface Element<BigDecimal>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode.
        See Also:
        Object.hashCode()
      • quotientRemainder

        public BigDecimal[] quotientRemainder(BigDecimal S)
        BigDecimal compute quotient and remainder.
        Parameters:
        S - BigDecimal.
        Returns:
        BigDecimal[] { q, r } with q = this/S and r = rem(this,S).
      • divideAndRemainder

        @Deprecated
        public BigDecimal[] divideAndRemainder(BigDecimal S)
        Deprecated. use quotientRemainder()
        BigDecimal compute quotient and remainder.
        Parameters:
        S - BigDecimal.
        Returns:
        BigDecimal[] { q, r } with q = this/S and r = rem(this,S).
      • egcd

        public BigDecimal[] egcd(BigDecimal S)
        BigDecimal extended greatest common divisor.
        Specified by:
        egcd in interface RingElem<BigDecimal>
        Parameters:
        S - BigDecimal.
        Returns:
        [ gcd(this,S), a, b ] with a*this + b*S = gcd(this,S).
      • random

        public BigDecimal random(int n)
        BigDecimal random.
        Specified by:
        random in interface ElemFactory<BigDecimal>
        Parameters:
        n - such that 0 ≤ val(r) ≤ (2n-1). 0 ≤ exp(r) ≤ (100-1).
        Returns:
        r, a random BigDecimal.
      • random

        public BigDecimal random(int n,
                                 java.util.Random rnd)
        BigDecimal random.
        Specified by:
        random in interface ElemFactory<BigDecimal>
        Parameters:
        n - such that 0 ≤ val(r) ≤ (2n-1). 0 ≤ exp(r) ≤ (100-1).
        rnd - is a source for random bits.
        Returns:
        r, a random BigDecimal.
      • random

        public BigDecimal random(int n,
                                 int e)
        BigDecimal random.
        Parameters:
        n - such that 0 ≤ val(r) ≤ (2n-1).
        e - such that 0 ≤ exp(r) ≤ (e-1).
        Returns:
        r, a random BigDecimal.
      • random

        public BigDecimal random(int n,
                                 int e,
                                 java.util.Random rnd)
        BigDecimal random.
        Parameters:
        n - such that 0 ≤ val(r) ≤ (2n-1).
        e - such that 0 ≤ exp(r) ≤ (e-1).
        rnd - is a source for random bits.
        Returns:
        r, a random BigDecimal.
      • parse

        public BigDecimal parse(java.lang.String s)
        BigDecimal parse from String.
        Specified by:
        parse in interface ElemFactory<BigDecimal>
        Parameters:
        s - String.
        Returns:
        Biginteger from s.
      • parse

        public BigDecimal parse(java.io.Reader r)
        BigDecimal parse from Reader.
        Specified by:
        parse in interface ElemFactory<BigDecimal>
        Parameters:
        r - Reader.
        Returns:
        next Biginteger from r.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.