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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:52:32+00:00 2026-06-08T22:52:32+00:00

I have a 64-bit long containing an IEEE 754 representation of a double .

  • 0

I have a 64-bit long containing an IEEE 754 representation of a double. I’d like to convert it to a string just like the standard Java Double.toString(d) does. However, I can’t use any of the methods of the Double class, because they are buggy. (String.valueOf(d) and "" + d don’t work either, because they use Double.toString(d) internally. NumberFormat doesn’t work, because it loses precision.) So I need pure Java code which would do the conversion.

Where can I find such code? I tried the source code of GNU Classpath, but it uses a native method for this conversion.

  • 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-06-08T22:52:33+00:00Added an answer on June 8, 2026 at 10:52 pm

    I searched a bit and I found that: dtoa.java.
    It seems complicated, but the code is under the GPL license (or the Mozilla Public License 1.1 license).

    I hope it will help you.

    (I even found the bug you refer to.)

    Edit:

    [Andrew Thompson] is right, you often (always?) lose precision with floating point.
    As pointed here, you might want to use BigDecimal

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a binary file (generated with Java) containing a 32 bit int
I have a bit field consisting of 64 bits: long bitfield = 0; I
This is a bit of a long shot as I don't have access to
Just to clarify, when you load my site I have a bit of text
I have a 32 bit long variable, CurrentPosition, that I want to split up
I have a 64-bit long that I want to round down to the nearest
EDIT seems my original post below might have been a bit long. Simply said,
On my little-endian z80-esque processor I have a 32-bit long int msk = 0xFFFFFF00
I have the following (little bit long) query : SELECT * FROM client C
Sorry the title is a little bit long. So I have a twitter account

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.