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 963187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:38:09+00:00 2026-05-16T01:38:09+00:00

As mentioned above. I give one example, let’s say all the test values are

  • 0

As mentioned above. I give one example, let’s say all the test values are less than 1 but greater than 0.

  • 0.12 (precision: 3, scale:2)
  • 0.345 (precision: 4, scale:3)
  • 0.6789 (precision: 5, scale:4)

how do i convert those value without hard-coding the scale and precision value.

  • 0.12 -> 12
  • 0.345 -> 345
  • 0.6789 -> 6789

for 0.1 and 0.01 and 0.001 should get 1 (i know this i bad idea but i have been given sets of business rules of the software)

i prefer solution in java but if there is a math algorithm it is better.
thanks.

  • 1 1 Answer
  • 0 Views
  • 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-16T01:38:10+00:00Added an answer on May 16, 2026 at 1:38 am

    The solution is much simpler then anybody presented here. You should use BigDecimal:

    BigDecimal a = new BigDecimal("0.0000012");
    BigDecimal b = a.movePointRight(a.scale());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a flash player that could handle all of the formats mentioned above.
As i clearly mentioned above, I would be glad to hear your ideas about
Ahoy all! Long story short with this one if you don't mind lending a
Let's say I've got a list of strings with Swedish words: banan , äpple
as mentioned in some other threads i'm a having trouble to setText inside a
somebody mentioned that the function (in this case a method) below is no good
As mentioned in the title, my launcher icon is showing up fine on the
Joel mentioned counting the number of set bits in a byte as a programming
Below mentioned is my XML, <?xml version=1.0 encoding=utf-8?> <soap:Envelopexmlns:soap=http://schemas.xmlsoap.org/soap/envelope/xmlns:xsi=http://www.w3.org/2001/XMLSchema-instancexmlns:xsd=http://www.w3.org/2001/XMLSchema> <soap:Body> <Response xmlns=http://tempuri.org/> <Result> <mp_response>
I get the error mentioned here: C++ Templates Error: no matching function for call

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.