COMS W1004 Lecture Notes - Lecture 16: Negative Number

45 views2 pages

Document Summary

One digit is called a bit in binary. With n being the number of bits you can have, 2^n - 1 possible combinations of numbers. Designate a sign bit to determine positive or negative. Magnitude is the same, only the left-most integer determines whether positive or negative. With 8-bit signed int: 127 combinations of numbers, but 255 unique combinations (+ and -) Left-most bit still determines negative number and positive numbers operate in same way. Half the value go to negative, other half go to non-negative. Left-most integer is both a number and determines positive and negative w/ 8 bit signed integer can got from 127 to -128. Test: if number is all 1s then it is -1. 1 followed by all zeroes will always be the smallest value representable. Every time see a 0, write down a 1 and vice versa. To negate: 1 0 0 + 0 0 1 = 1 0 1 = -3.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents