Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix inconsistency between floating-point number's storage (#13)
# 问题:浮点数的存储和输出格式不一致导致无法精确查找 ### 描述:现有TDB的float存储时未作截断,打印时截断至两位小数导致无法精确查找。因此取消打印时的位数截断。  #### 分析:直接打印为 %f 不会因为缓冲区导致截断 float的阶码为8位,尾数为23位。 规格化最大正数为:2^24-1)x2^(127-23) = (2^24-1)x2^104,即 3.4028235E+38 规格化最小正数为:1x2^(-126),即1.1754943E-38 非规格化最小正数为:2^(-23)x2^(-126)=2^(-149),即1.401298E-45 均不会超过分配的256字节的缓冲区buf,因此可以完整输出。 Co-authored-by: thu <[email protected]> Co-authored-by: YangCaiyin <[email protected]>
- Loading branch information