Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4020356
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:13:05+00:00 2026-05-20T10:13:05+00:00

Is there a datatype in Java that stores a decimal number more precisely than

  • 0

Is there a datatype in Java that stores a decimal number more precisely than a double?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:13:06+00:00Added an answer on May 20, 2026 at 10:13 am

    Yes, use java.math.BigDecimal class. It can represent numbers with great precision.

    If you just need huge integers, you can use java.math.BigInteger instead.

    They both extend java.math.Number.

    You can even use your existing doubles if you need:

    double d = 67.67;
    BigDecimal bd = new BigDecimal(d);
    

    And you can get BigDecimal values out of databases with JDBC:

    ResultSet rs = st.executeQuery();
    while(rs.next()) {
        BigDecimal bd = rs.getBigDecimal("column_with_number");
    }
    

    Unfortunately, since Java does not support operator overloading, you can’t use regular symbols for common mathematical operations like you would in C# and the decimal type.

    You will need to write code like this:

    BigDecimal d1 = new BigDecimal(67.67);
    BigDecimal d2 = new BigDecimal(67.68);
    BidDecimal d3 = d1.add(d2); // d1 + d2 is invalid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a datatype within C# that if you put to for example 0001,
I just want to ask if there is any PHP/MySQL datatype that can store
The Java Virtual Machine Specification says that there is limited support for boolean primitive
I am wondering if there are java methods/objects that would be alternatives to cfquery,
Is there any datatype /container in any language which checks for the uniqueness of
Is there a data type in eVC++ that is the equivalent of __int64 ?
Is there any primitive data type that it's safe to not initialize? How about
I noticed that in C# there are both a byte and Byte data type.
I was wondering, why can't there be a void data type that is not
Java date & time datatypes are as everybody knows, there's no need to focus

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.