How integers are stored in memory

Daniel felipe Escobar chavez
2 min readApr 1, 2021

Write a blog post on how integers are stored in memory using two’s complement, now returning to the binaries, a binary number is a number made up of 1 or 0 and these are the ones that will always define what number each is, as we can see in the following table along with a sample of the extra conversion between decimals and binaries.

Now the question that needs to be resolved is how is this conversion done with negative numbers?

the form of representation is to use 1’s complement to represent negative numbers. The first bit is also reserved to represent the sign and the rest of the bits are used to represent:

This is how it works since a sum is made between the number and its negative complement, making it represent itself in binary.

In conclusion, it can be said that the numbers are stored in binary depending on whether the result of the same by a division by two or in other words by a conversion to binary and the negatives will be stored in the same way by exchanging 1 and in one this

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response