Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about twos-complement

Read more about twos-complement

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - twos-complement

Why complement of 0 is -1?

I was learning about bitwise operators and I learnt that complement of 0 is 1 and 1 is 0. But when I tried using ~0 on IDLE, it printed -1 and when i typed ~1 it gave -2..
test-img

Satyam Shankar

python

binary

twos-complement

complement

ones-complement

Votes: 0

Answers: 1

Latest Answer

-1 is 0-1 => 00..00-00...01 = 1..11 So, as long as you consider some finite width (width is the size of integer or binary form you are using,4,8 ....),it is true that: 00..00 =~11..11 then, th...
test-img

Ixtiyor Majidov

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved