How can you inspect the binary scale of floating readings?

frexp decomposes a finite nonzero float into a mantissa and integer exponent whose power-of-two product reconstructs the value.

Python example and interpretation

Eight and sixteen have the same mantissa of 0.5 and exponents one apart. That describes numeric scale; decision thresholds should still use the measurement's physical units.

from math import frexp
[frexp(x) for x in [8.,16.]]

Result [(0.5, 4), (0.5, 5)]

中文

如何看出两个浮点读数是否处在不同二进制量级?

frexp 把有限非零值拆成尾数和整数指数,原值等于尾数乘以二的指数次幂。

Python 算例与适用条件

8 与 16 的尾数都是 0.5,指数相差一。这描述存储尺度,阈值仍应以读数的物理单位定义。

from math import frexp
[frexp(x) for x in [8.,16.]]

结果 [(0.5, 4), (0.5, 5)]

References / 参考来源

Keep reading / 继续阅读