IT. Expert System.

Android Reference

MathContext


java.math

Class MathContext

  • All Implemented Interfaces:
    Serializable


    public final class MathContext
    extends Object
    implements Serializable
    Immutable objects describing settings such as rounding mode and digit precision for the numerical operations provided by class BigDecimal.
    See Also:
    Serialized Form
    • Constructor Detail

      • MathContext

        public MathContext(int precision)
        Constructs a new MathContext with the specified precision and with the rounding mode HALF_UP. If the precision passed is zero, then this implies that the computations have to be performed exact, the rounding mode in this case is irrelevant.
        Parameters:
        precision - the precision for the new MathContext.
        Throws:
        IllegalArgumentException - if precision < 0.
      • MathContext

        public MathContext(int precision,
                   RoundingMode roundingMode)
        Constructs a new MathContext with the specified precision and with the specified rounding mode. If the precision passed is zero, then this implies that the computations have to be performed exact, the rounding mode in this case is irrelevant.
        Parameters:
        precision - the precision for the new MathContext.
        roundingMode - the rounding mode for the new MathContext.
        Throws:
        IllegalArgumentException - if precision < 0.
        NullPointerException - if roundingMode is null.
      • MathContext

        public MathContext(String s)
        Constructs a new MathContext from a string. The string has to specify the precision and the rounding mode to be used and has to follow the following syntax: "precision=<precision> roundingMode=<roundingMode>" This is the same form as the one returned by the toString() method.
        Throws:
        IllegalArgumentException - if the string is not in the correct format or if the precision specified is < 0.
    • Method Detail

      • getPrecision

        public int getPrecision()
        Returns the precision. The precision is the number of digits used for an operation. Results are rounded to this precision. The precision is guaranteed to be non negative. If the precision is zero, then the computations have to be performed exact, results are not rounded in this case.
        Returns:
        the precision.
      • equals

        public boolean equals(Object x)
        Returns true if x is a MathContext with the same precision setting and the same rounding mode as this MathContext instance.
        Overrides:
        equals in class Object
        Parameters:
        x - object to be compared.
        Returns:
        true if this MathContext instance is equal to the x argument; false otherwise.
        See Also:
        Object.hashCode()
      • toString

        public String toString()
        Returns the string representation for this MathContext instance. The string has the form "precision=<precision> roundingMode=<roundingMode>" where <precision> is an integer describing the number of digits used for operations and <roundingMode> is the string representation of the rounding mode.
        Overrides:
        toString in class Object
        Returns:
        a string representation for this MathContext instance


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 330 / 248377535. Delta: 0.03078 с