fix: fix inconsistency between floating-point number's storage and output in TDB/deps/common/lang/string.cpp #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题:浮点数的存储和输出格式不一致导致无法精确查找
描述:现有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,因此可以完整输出。