পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, January 19, 2017

Java.math.MathContext Class

Introduction

The java.math.MathContext class provides immutable objects which encapsulate the context settings and describes certain rules for numerical operators, such as those implemented by the BigDecimal class.
The base-independent settings are:

  • precision: the number of digits to be used for an operation; results are rounded to this precision.
  • roundingMode: a RoundingMode object which specifies the algorithm to be used for rounding.

Class declaration

Following is the declaration for java.math.MathContext class:
public final class MathContext
    extends Object
        implements Serializable

Field

Following are the fields for java.math.MathContext class:
  • static MathContext DECIMAL128 -- A MathContext object with a precision setting matching the IEEE 754R Decimal128 format, 34 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
  • static MathContext DECIMAL32 -- A MathContext object with a precision setting matching the IEEE 754R Decimal32 format, 7 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
  • static MathContext DECIMAL64 -- A MathContext object with a precision setting matching the IEEE 754R Decimal64 format, 16 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
  • static MathContext UNLIMITED -- A MathContext object whose settings have the values required for unlimited precision arithmetic.

Class constructors

S.N. Constructor & Description
1 MathContext(int setPrecision) This constructor, constructs a new MathContext with the specified precision and the HALF_UP rounding mode.
2 MathContext(int setPrecision, RoundingMode setRoundingMode) This constructor, constructs a new MathContext with a specified precision and rounding mode.
3 MathContext(String val) This constructor, constructs a new MathContext from a string.

Class methods

S.N. Method & Description
1 boolean equals(Object x)
This method compares this MathContext with the specified Object for equality.
2 int getPrecision()
This method returns the precision setting.
3 RoundingMode getRoundingMode()
This method returns the roundingMode setting.
4 int hashCode()
This method returns the hash code for this MathContext.
5 String toString()
This method returns the string representation of this MathContext.

No comments:

Post a Comment