Documentation of 'cc.redberry.core.number.Numeric' Java class
Numeric
cc.redberry.core.number

Class Numeric

  • All Implemented Interfaces:
    Number<Real>, java.io.Serializable, java.lang.Comparable<Real>, org.apache.commons.math3.FieldElement<Real>


    public final class Numeric
    extends Real
    implements java.io.Serializable
    Implementation of floating point numbers based on Java double.

    This class implements all mathematical operations declared in Number as operations with doubles. So all methods return numeric numbers. As for example, 1.0 + 2 / 3 will give 1.666666 and so on. All mathematical methods works with its arguments using Number.doubleValue() method.

    See Also:
    Number, Double, Serialized Form
    • Field Detail

      • ZERO

        public static final Numeric ZERO
        A constant holding 0 value.
      • ONE

        public static final Numeric ONE
        A constant holding 1 value.
      • MINUS_ONE

        public static final Numeric MINUS_ONE
        A constant holding -1 value.
      • POSITIVE_INFINITY

        public static final Numeric POSITIVE_INFINITY
        A constant holding the positive infinity of type double. It is equal to the value returned by Double.longBitsToDouble(0x7ff0000000000000L).
        See Also:
        Double.POSITIVE_INFINITY
      • NEGATIVE_INFINITY

        public static final Numeric NEGATIVE_INFINITY
        A constant holding the negative infinity of type double. It is equal to the value returned by Double.longBitsToDouble(0xfff0000000000000L).
        See Also:
        Double.NEGATIVE_INFINITY
      • NaN

        public static final Numeric NaN
        A constant holding a Not-a-Number (NaN) value of type double. It is equivalent to the value returned by Double.longBitsToDouble(0x7ff8000000000000L).
        See Also:
        Double.NaN
      • MAX_VALUE

        public static final Numeric MAX_VALUE
        A constant holding the largest positive finite value of type double, (2-2-52)·21023. It is equal to the hexadecimal floating-point literal 0x1.fffffffffffffP+1023 and also equal to Double.longBitsToDouble(0x7fefffffffffffffL).
        See Also:
        Double.MAX_VALUE
      • MIN_NORMAL

        public static final Numeric MIN_NORMAL
        A constant holding the smallest positive normal value of type double, 2-1022. It is equal to the hexadecimal floating-point literal 0x1.0p-1022 and also equal to Double.longBitsToDouble(0x0010000000000000L).
        See Also:
        Double.MIN_NORMAL
      • MIN_VALUE

        public static final Numeric MIN_VALUE
        A constant holding the smallest positive nonzero value of type double, 2-1074. It is equal to the hexadecimal floating-point literal 0x0.0000000000001P-1022 and also equal to Double.longBitsToDouble(0x1L).
        See Also:
        Double.MIN_VALUE
    • Constructor Detail

      • Numeric

        public Numeric(double value)
      • Numeric

        public Numeric(int value)
      • Numeric

        public Numeric(float value)
      • Numeric

        public Numeric(Number value)
        Constructs a new Numeric instance, which double variable is taken from value.doubleValue(). So, this constructor makes
        this.value = value.doubleValue();
        Parameters:
        value - the value, which double representation to be represented by the Double.
        Throws:
        org.apache.commons.math3.exception.NullArgumentException - if value is null.
    • Method Detail

      • bigIntValue

        public java.math.BigInteger bigIntValue()
        Specified by:
        bigIntValue in interface Number<Real>
      • add

        public Numeric add(Real n)
        Specified by:
        add in interface org.apache.commons.math3.FieldElement<Real>
      • divide

        public Numeric divide(Real n)
        Specified by:
        divide in interface org.apache.commons.math3.FieldElement<Real>
      • multiply

        public Numeric multiply(int n)
        Specified by:
        multiply in interface org.apache.commons.math3.FieldElement<Real>
      • multiply

        public Numeric multiply(Real n)
        Specified by:
        multiply in interface org.apache.commons.math3.FieldElement<Real>
      • subtract

        public Numeric subtract(Real n)
        Specified by:
        subtract in interface org.apache.commons.math3.FieldElement<Real>
      • negate

        public Numeric negate()
        Specified by:
        negate in interface org.apache.commons.math3.FieldElement<Real>
      • reciprocal

        public Numeric reciprocal()
        Specified by:
        reciprocal in interface org.apache.commons.math3.FieldElement<Real>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        similar to Double
        See Also:
        Double.hashCode()
      • isInfinite

        public boolean isInfinite()
        Specified by:
        isInfinite in interface Number<Real>
        Returns:
        Double.isInfinite(value)
        See Also:
        Double.isInfinite(double)
      • isNaN

        public boolean isNaN()
        Specified by:
        isNaN in interface Number<Real>
        Returns:
        Double.isNaN(value)
        See Also:
        Double.isNaN(double)
      • add

        public Numeric add(org.apache.commons.math3.fraction.BigFraction fraction)
        Specified by:
        add in interface Number<Real>
      • divide

        public Numeric divide(org.apache.commons.math3.fraction.BigFraction fraction)
        Specified by:
        divide in interface Number<Real>
      • multiply

        public Numeric multiply(org.apache.commons.math3.fraction.BigFraction fraction)
        Specified by:
        multiply in interface Number<Real>
      • subtract

        public Numeric subtract(org.apache.commons.math3.fraction.BigFraction fraction)
        Specified by:
        subtract in interface Number<Real>
      • pow

        public Numeric pow(java.math.BigInteger exponent)
        Specified by:
        pow in interface Number<Real>
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Double.equals(java.lang.Object)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Double.toString()
      • isZero

        public boolean isZero()
        Specified by:
        isZero in interface Number<Real>
      • compareTo

        public int compareTo(Real o)
        Specified by:
        compareTo in interface java.lang.Comparable<Real>
        See Also:
        Double.compare(double, double)
      • isOne

        public boolean isOne()
        Specified by:
        isOne in interface Number<Real>
      • signum

        public int signum()
        Description copied from class: Real
        Returns signum of this.
        Specified by:
        signum in class Real
        Returns:
        signum

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.