ECSE 221 Lecture 2: ECSE 221 Lecture Notes #2

34 views1 pages

Document Summary

Ecse 221 lecture note #2: number representation, base conversion and binary. Converting from decimal to binary, for some number n: write n as an even number + 0 or 1 as appropriate: N = q * 2 + r, and r is the binary digit. We can then represent q as an even number + 0 or 1. N = (q2 * 2 + r2) * 2 + r. N = ((q3 * 2 + r3) * 2 + r2) * 2 + r. We can continue to recursively expand n (3,4,5 so on), and we can eventually re-write it such that we group r"s together, and the terms r are the coefficients we are looking for. Eventually, our expansion"s coefficients will give us a visible representation of the binary representation of the number. Once int[q(j-1)/b] =0, stop: int: integer (whole number, j: the loop index, b: base of the results converted number, formal procedure for base-a (na) base-b (nb)

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