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

The Archive Base Latest Questions

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

Do the underlying bits just get reinterpreted as a floating point value? Or is

  • 0

Do the underlying bits just get “reinterpreted” as a floating point value? Or is there a run-time conversion to produce the nearest floating point value?

Is endianness a factor on any platforms (i.e., endianness of floats differs from ints)?

How do different width types behave (e.g., int to float vs. int to double)?

What does the language standard guarantee about the safety of such casts/conversions? By cast, I mean a static_cast or C-style cast.

What about the inverse float to int conversion (or double to int)? If a float holds a small magnitude value (e.g., 2), does the bit pattern have the same meaning when interpreted as an int?

  • 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-13T10:54:35+00:00Added an answer on May 13, 2026 at 10:54 am

    Do the underlying bits just get “reinterpreted” as a floating point value?

    No, the value is converted according to the rules in the standard.

    is there a run-time conversion to produce the nearest floating point value?

    Yes there’s a run-time conversion.

    For floating point -> integer, the value is truncated, provided that the source value is in range of the integer type. If it is not, behaviour is undefined. At least I think that it’s the source value, not the result, that matters. I’d have to look it up to be sure. The boundary case if the target type is char, say, would be CHAR_MAX + 0.5. I think it’s undefined to cast that to char, but as I say I’m not certain.

    For integer -> floating point, the result is the exact same value if possible, or else is one of the two floating point values either side of the integer value. Not necessarily the nearer of the two.

    Is endianness a factor on any platforms (i.e., endianness of floats differs from ints)?

    No, never. The conversions are defined in terms of values, not storage representations.

    How do different width types behave (e.g., int to float vs. int to double)?

    All that matters is the ranges and precisions of the types. Assuming 32 bit ints and IEEE 32 bit floats, it’s possible for an int->float conversion to be imprecise. Assuming also 64 bit IEEE doubles, it is not possible for an int->double conversion to be imprecise, because all int values can be exactly represented as a double.

    What does the language standard guarantee about the safety of such casts/conversions? By cast, I mean a static_cast or C-style cast.

    As indicated above, it’s safe except in the case where a floating point value is converted to an integer type, and the value is outside the range of the destination type.

    If a float holds a small magnitude value (e.g., 2), does the bit pattern have the same meaning when interpreted as an int?

    No, it does not. The IEEE 32 bit representation of 2 is 0x40000000.

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

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I stumbled upon this while searching for something else. I… May 14, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer simply reverse the four bytes works float ReverseFloat( const float… May 14, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer This solution works: INSERT INTO MONTH_REF (DISTRICT_ID,STATION_ID,CATEGORY_ID,YEAR,MONTH) VALUES('101','QFEG','012',1973,08); SET @month_ref_id… May 14, 2026 at 6:01 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.