Current location - Training Enrollment Network - Mathematics courses - What is the original code?
What is the original code?
Question 1: What is the original code? True shape is a binary fixed-point representation of numbers in a computer. The original notation is to add a sign bit (i.e. the highest sign bit) in front of the numerical value, where 0 represents a positive number, 1 represents a negative number, and the remaining bits represent the size of the numerical value.

Advantages of the original code: simple and intuitive; For example, we use 8-bit binary to represent a number. The original code of+1 1 is 000010, and the original code of-1 1 is1.

Disadvantages: the original code can't directly participate in the operation, and it may make mistakes. For example, mathematically, 1+(- 1)=0, while in binary, 0000065438+1000001=10000010, which is converted into decimal. There is obviously a mistake.

Therefore, the symbol bits of the original code cannot directly participate in the operation, and must be separated from others, which increases the hardware overhead and complexity.

Specific definitions are divided into decimals and integers:

① Definition of decimal source code

[X] =

X 0≤X < 1

1- X - 1 < X ≤ 0

For example: x =+0.101,[x] original = 0101.

x =-0. 10 1 1[x]Original = 1 10 1。

② Definition of integer source code

[X] Original =

X 0≤X