定点数的实现

Reference

(13 条消息) 帧同步中使用定点数(Fixed Point)的问题? - 知乎 (zhihu.com)

Fixed Point Representation - GeeksforGeeks — 定点表示 - GeeksforGeeks

浅谈游戏开发中的浮点数与定点数 (wmf.im)

定点数(fixed-point number)的表示方法_定点数表示-CSDN博客

正文

Shifting Pattern

When an integer is shifted right by one bit in a binary system, it is comparable to being divided by two. Since we cannot represent a digit to the right of a binary point in the case of integers since there is no fractional portion, this shifting operation is an integer division.

当一个整数在二进制系统中右移一位时,相当于除以二。由于在整数情况下我们无法表示二进制小数点右侧的数字,因为没有小数部分,因此这种移位操作是整数除法。

  • A number is always divided by two when the bit pattern of the number is shifted to the right by one bit.
    当数字的位模式右移一位时,数字总是除以二
  • A number is multiplied by two when it is moved left one bit.
    当数字向左移动一位时,该数字会乘以 2