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

  • Home
  • SEARCH
  • 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 6531543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:53:26+00:00 2026-05-25T09:53:26+00:00

This isn’t a question for a real-life project; I’m only curious. We can increase

  • 0

This isn’t a question for a real-life project; I’m only curious.

We can increase an int using the increment operator (i++). You can define this operation as:
This increases the variable with the closest value to i. Which is in this case simply +1.

But I was thinking of defining the number of double values available in a specific range according the IEEE 754-2008 system. I would be able to set up a graph which demonstrates these amounts in some ranges and see how it is decreasing.

I guess there should be a bitwise way of increasing a double to the closest value greater than the original double.

What I found on Wikipedia is this:

Double precision examples

0x 3ff0 0000 0000 0000   = 1
0x 3ff0 0000 0000 0001   = 1.0000000000000002, the next higher number > 1
0x 3ff0 0000 0000 0002   = 1.0000000000000004

Here, you can see that the next higher number is obtained by increasing the binary content. But I don’t think that this will keep working since the double scheme looks like this:

enter image description here

I think something else should be performed to make the smallest increase when all the fraction bits are set to one.

Maybe this operation has a name? Interesting references?
Any information is welcome 😀

Thanks

  • 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-25T09:53:26+00:00Added an answer on May 25, 2026 at 9:53 am

    Here, you can see that the next higher number is obtained by increasing the binary content. But I don’t think that this will keep working since the double scheme looks like this:

    [picture omitted]

    I think something else should be performed to make the smallest increase when all the fraction bits are set to one.

    To a first approximation, yes, this does work.

    Consider a normalised positive number: this is a value m * 2e where 1 <= m < 2 , i.e. m = 1.xxxxxxx (in binary) . The “1” before the binary point is omitted in the stored value, so the “fraction” (or “mantissa” or “significand”) part of the stored value consists of the bits after the binary point.

    Let’s imagine that there are only 4 bits in the fraction part, rather than 52: the stored value 1111 (binary) represents in the fraction part m = 1.1111 (binary). Treating this as an integer and incrementing it gives a fraction part of 0000 with a carry.

    But the carry goes into the exponent, which increments it. That’s exactly right: after 1.1111 * 2e, the next number we expect is 10.0000, which is indeed 1.0000 * 2e+1 !


    I said “to a first approximation”… converting the representation to an integer, incrementing, and converting back to a double, does work nicely for positive normalised numbers. It also works for positive denormalised numbers (smaller than the smallest normalised number; these have an exponent of 0 and the bit which is usually hidden is explicit).

    It works for negative numbers if your integer representation is also sign-magnitude; which it usually won’t be. For the more typical two’s complement, you have to subtract one to “increment” a negative double.

    Finally, eventually you will overflow the largest normalised number and increment the exponent into the infinity and NaN range.

    There is an interesting article which covers this here.

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

Sidebar

Related Questions

This isn't that complicated of a question, but I can't wrap my head around
This isn't a jQuery only question as it has to do with events and
This isn't a holy war, this isn't a question of which is better. What
This isn't a question but I thought I'd start a thread where links to
This isn't working. Can this be done in find? Or do I need to
This isn't quite as straight forward as one may think. I'm using a plugin
This isn't really a programming question but more about programming and testing tools. Is
This isn't working in IE (although it does work in FFX). Why? Using HTML
This isn't a very simple question, but hopefully someone has run across it. I
This isn't exactly a programming question exactly. I just want to know what your

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.