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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:02:12+00:00 2026-05-14T20:02:12+00:00

There are certain int values that a float can not represent. However, can a

  • 0

There are certain int values that a float can not represent.

However, can a double represent all values a float can represent?

My intuition says yes, since double has more fractional bits & more exponent bits, but there might be some silly gotchas that I’m missing.

  • 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-14T20:02:13+00:00Added an answer on May 14, 2026 at 8:02 pm

    Yes.

    It would probably help to know how floats and doubles work.

    Without going too much into details…

    Take the number 152853.5047 ( the revolution period of Jupiter’s moon Io in seconds )

    In scientific notation, this number is 0.1528535047 × 10^6

    Since computers only understand 1 and 0, there is way to define .

    The mantissa (1528535047) and the exponent (6) are stored within 32-bits… if I remember correctly, only 24-bits are for the mantissa, so floating point is usually more about precision than size. The larger the number, the less precise it can be.

    1528535047 = 1011011000110111001100000000111 so you can only store the first 24-bits… the last three 1’s are lopped off.

    Since Integers are 32-bits, you’re right, a floating point can’t accurately contain it. less significant digits get lopped off the end.

    Any integer with an absolute value of less than 2^24 ( 24-bits )can be stored without losing precision. (16,777,216)

    This is how the bits are stored in a floating point number:

    How floats are stores diagram http://phimuemue.wordpress.com/files/2009/06/576px-ieee-754-single-svg1.png

    source
    One bit for the sign, 8-bits for the exponent and 23-bits for the mantissa. Therefore, to answer your question, since only 23-bits are reserved for the mantissa, a 32-bit integer can’t be showed with precision. It will quickly start lopping off numbers ( from the right ) as there are more digits needed to display.

    For a double, you’re merely increasing the number of bits that it can store… in fact, it’s called double precision so any number that can be shown as a float is capable of being shown as a double. Extra 0’s are merely added to the mantissa.

    For this reason, since a double takes up 64-bits, most people will use a double when converting from a 32-bit int to a double. A float would be good for converting a 16-bit short.

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

Sidebar

Related Questions

There are certain parts of my UserEntity that I would like to be able
There are certain classes, such as Closeable , File and Container , that have
Is there a certain type of SQL field that acts as a sequential number
I'm using a certain regex to know where there a certain string values in
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
I'm currently implementing a software that measures certain values over time. The user may
How can HQL be used to select specific objects that meet a certain criteria?
I have a Dictionary<int, int> and would like to update certain elements all at
I know that I can use templates to assume that certain classes used by
In various projects there are certain parts I will keep jumping to. Is there

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.