Class Calculator

    • Method Summary

      Modifier and Type Method Description
      Calculator abs()
      Calculates the absolute value of this Calculator´s accumulator, then stores the result in the accumulator.
      Calculator add​(Number number)
      Adds number to this Calculator´s accumulator, then stores the result in the accumulator.
      Calculator divide​(Number number)
      Divides this Calculator´s accumulator by number, then stores the result in the accumulator.
      Calculator exp()
      Calculates Euler's constant taken to the power of this Calculator´s accumulator, then stores the result in the accumulator.
      protected static Calculator getInstance()
      Returns a new instance of a Calculator initialized with the default NumberSystem, as set at Calculus.currentNumberSystem()
      boolean isLessThanOne()  
      Calculator load​(Number number)
      Loads number into this Calculator´s accumulator.
      Calculator log()
      Calculates the natural logarithm of this Calculator´s accumulator, then stores the result in the accumulator.
      Calculator multiply​(Number number)
      Multiplies number with this Calculator´s accumulator, then stores the result in the accumulator.
      Calculator negate()
      Calculates the additive inverse value of this Calculator´s accumulator, then stores the result in the accumulator.
      static Calculator of​(Number number)
      Shortcut for getDefault().load(number).
      Number peek()
      Allows to 'peek' at this Calculator´s accumulator.
      Calculator power​(int exponent)
      Takes this Calculator´s accumulator to the integer power of exponent, then stores the result in the accumulator.
      Calculator reciprocal()
      Calculates the multiplicative inverse value of this Calculator´s accumulator, then stores the result in the accumulator.
      Calculator subtract​(Number number)
      Subtracts number from this Calculator´s accumulator, then stores the result in the accumulator.
    • Method Detail

      • of

        public static Calculator of​(Number number)
        Shortcut for getDefault().load(number). See getInstance() and load(Number)
        Parameters:
        number -
        Returns:
        default Calculator with number loaded into its accumulator
      • load

        public Calculator load​(Number number)
        Loads number into this Calculator´s accumulator.
        Parameters:
        number -
        Returns:
        self
      • add

        public Calculator add​(Number number)
        Adds number to this Calculator´s accumulator, then stores the result in the accumulator.
        Parameters:
        number -
        Returns:
        self
      • subtract

        public Calculator subtract​(Number number)
        Subtracts number from this Calculator´s accumulator, then stores the result in the accumulator.
        Parameters:
        number -
        Returns:
        self
      • multiply

        public Calculator multiply​(Number number)
        Multiplies number with this Calculator´s accumulator, then stores the result in the accumulator.
        Parameters:
        number -
        Returns:
        self
      • divide

        public Calculator divide​(Number number)
        Divides this Calculator´s accumulator by number, then stores the result in the accumulator.
        Parameters:
        number -
        Returns:
        self
      • power

        public Calculator power​(int exponent)
        Takes this Calculator´s accumulator to the integer power of exponent, then stores the result in the accumulator.
        Parameters:
        exponent -
        Returns:
        self
      • abs

        public Calculator abs()
        Calculates the absolute value of this Calculator´s accumulator, then stores the result in the accumulator.
        Returns:
        self
      • negate

        public Calculator negate()
        Calculates the additive inverse value of this Calculator´s accumulator, then stores the result in the accumulator.
        Returns:
        self
      • reciprocal

        public Calculator reciprocal()
        Calculates the multiplicative inverse value of this Calculator´s accumulator, then stores the result in the accumulator.
        Returns:
        self
      • exp

        public Calculator exp()
        Calculates Euler's constant taken to the power of this Calculator´s accumulator, then stores the result in the accumulator.
        Returns:
        self
      • log

        public Calculator log()
        Calculates the natural logarithm of this Calculator´s accumulator, then stores the result in the accumulator.
        Returns:
        self
      • peek

        public Number peek()
        Allows to 'peek' at this Calculator´s accumulator. The Number returned is narrowed to best represent the numerical value w/o loss of precision within the NumberSystem as configured for this Calculator instance.
        Returns:
        a narrowed version of this Calculator´s accumulator
      • isLessThanOne

        public boolean isLessThanOne()
        Returns:
        whether this Calculator´s accumulator is less than ONE