AOA - chapter 2: Data Representation

本文详细解释了从十进制到二进制的转换方法,以及如何使用除以二并记录余数来区分奇偶数。进一步介绍了位和字节的概念,包括它们在计算机中的应用,如二进制编码、十六进制表示和不同数据类型(如字、双字、字节等)。此外,还讨论了二进制补码表示负数的方法,并提供了在不同数据类型中存储正负数的规则。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Decimal -> Binary:
1) Power of 2 down to 2**0
2) even/odd - divided by two algorithm
- first step: even - 0, odd -1
- second step: * / 2: quotient even: prefix 0
quotient odd: prefix 1
go back to second step
2. Low order -> least significant bit
High order -> most significant bit
3.
-Bit
-Nibble represents: 4 bits
a) Binary coded decimal numbers
b) Hexadecimal numbers
-Byte: 8bits
a)smallest addressable datum
b)byte values require two hexadecimal digits
c)usage:
- signed or unsigned numbers (-128..127, 0..255)
- ASCII character codes: 128 for ASCII characters, remaining 128 for European characters, graphic symbols, Greek letters, math symbols.
-Word:
a)Usage:
- unsigned and signed integer values
- unicode characters
-Double Word
a)Usage:
- unsigned and signed integer values
- pointer variable

4.Hexadecimal numbering system:
a)Advantage:
- compact
- simple to convert to binary and vice versa

5.Logical operation
a)Truth table
b)AND -> used to force a zero result
c)OR -> used to force a one result
b)XOR -> more closer to the english meaning of 'or'
-> used to invert a bit.

c) OPERATION (source, dest)
=> dest = dest OPERATION src

6. Two's complement notation
- High order bit is a sign bit: 0 - positive, 1-negative

7. Positive number - stored as standard binary value
8. Negative number - stored in the two's complement form
a)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值