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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:43:52+00:00 2026-05-14T00:43:52+00:00

I need to represent an IEEE 754-1985 double (64-bit) floating point number in a

  • 0

I need to represent an IEEE 754-1985 double (64-bit) floating point number in a human-readable textual form, with the condition that the textual form can be parsed back into exactly the same (bit-wise) number.

Is this possible/practical to do without just printing the raw bytes?
If yes, code to do this would be much appreciated.

  • 1 1 Answer
  • 2 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-14T00:43:52+00:00Added an answer on May 14, 2026 at 12:43 am

    Best option: Use the C99 hexadecimal floating point format:

    printf("%a", someDouble);
    

    Strings produced this way can be converted back into double with the C99 strtod( ) function, and also with the scanf( ) functions. Several other languages also support this format. Some examples:

    decimal number    %a format     meaning
    --------------------------------------------
    2.0               0x1.0p1       1.0 * 2^1
    0.75              0x1.8p-1      1.5 * 2^-1
    

    The hexadecimal format has the advantage that all representations are exact. Thus, converting the string back into floating-point will always give the original number, even if someone changes the rounding mode in which the conversion is performed. This is not true for inexact formats.

    If you don’t want to use the hexadecimal format for whatever reason, and are willing to assume that the rounding mode will always be round to nearest (the default), then you can get away with formatting your data as decimals with at least 17 significant digits. If you have a correctly rounded conversion routine (most — not all — platforms do), this will guarantee that you can do a round trip from double to string and back without any loss of accuracy.

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

Sidebar

Related Questions

I have a floating point value, but when i need to represent to the
In need to construct System.Single values (= IEEE 754 single precision 32-bit floats) from
I need to represent a 40-bit binary number. Which C datatype should be used
How can I combine 2 ints to a single 32bit IEEE floating point ?
I need to represent a condition where the value of the JSpinner is not
I would like to represent a 10 bit unsigned integer in C#. I need
I need to represent calculator key presses by the text for the keys to
We need to represent huge numbers in our application. We're doing this using integer
I need to represent immutable vectors in Python (vectors as in linear algebra, not
I need to represent that a property on an object is different from that

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.