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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:45:28+00:00 2026-06-17T08:45:28+00:00

As we know, IEEE floating point numbers can store exact representations of all integers

  • 0

As we know, IEEE floating point numbers can store exact representations of all integers and integer multiples of inverses-of-powers-of-two such as 1/2 or 3/4, as long the numbers keep within the range of the floating-point type.

However, do floating-point parsers generally guarantee exact results of parsing decimal representations of such numbers?

For instance, if I use 0.75 as a double literal in a C program, will the compiler guarantee that the compiled code contains the exact representation of 3/4, or is there a risk that it will produce the sum of some inexact representation of 0.7 and some inexact representation of 0.05?

Or, likewise, if I use 3e4 as a double literal, might the exact 3 be multiplied by some inexact representation of 2^(4*ln(10)/ln(2)) or some similar math?

Are there any standards that FP-parsers are generally required to follow in this matter, or is it generally left entirely to the implementation? If it is the latter, does anyone know how practically important implementations like GCC or glibc actually work?

I’m mostly just asking for curiosity and not because I want to rely on the behavior; but it might, at times, be quite convenient to know that FP equality comparisons are guaranteed to work if the values can be known to only come from literal sources.

  • 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-17T08:45:29+00:00Added an answer on June 17, 2026 at 8:45 am

    The C standard permits a floating-point constant to be either the representable value nearest to the exact value of the literal constants or the larger or smaller representable value immediately adjacent to the nearest value, per C 2011 6.4.4.2 3. Some C implementations do better. Modern implementations should do better, as there are published algorithms for doing the conversion correctly.

    However, the C standard also provides for hexadecimal floating-point constants, which make it easy for a compiler to do the conversion correctly. A hexadecimal floating-point constant has the basic form 0xhhh.hhhpeee, where hhh are hexadecimal digits and eee is a decimal exponent, which may have a sign. (The hexadecimal digits on one side of the “.” may be omitted if they are zero, and the period may be omitted if the digits on the right are omitted.) The exponent is for a power of two.

    The C standard requires that a hexadecimal floating-point constant be correctly rounded if the radix for floating-point numbers is a power of 2 in the C implementation. It recommends that a diagnostic message be produced if the hexadecimal constant cannot be represented exactly.

    E.g., 0x3p-2 should be exactly .75.

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

Sidebar

Related Questions

I know that for floating point numbers IEEE has a standard representation format -
I know the IEEE 754 floating point standard by heart as I had to
So I know the IEEE 754 specifies some special floating point values for values
I know a little bit about how floating-point numbers are represented, but not enough,
as all know decimal fractions (like 0.1) , when stored as floating point (like
As far as I know floating point values are of the form n *
Is it possible to get the raw bytes of a floating point (IEEE-754) Number
I am writing an (almost) IEEE 854 compliant floating point implementation in TeX (which
I am wondering how to implement IEEE-754 32-bit single precision floating point division in
I know you can not set a key value dynamically, but what about the

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.