MasterJH5574 opened a new pull request #7846: URL: https://github.com/apache/tvm/pull/7846
This PR fixes a bug in SaveLoad, which didn't save enough digits for double value and may cause precision loss when loading the value from JSON again. Besides, this PR adds a regression test for the precision loss case. Before this PR, double value is saved with precision 16. However, actually we should save at least 17 digits to avoid precision loss, according to [IEEE 754-1985 standard](https://standards.ieee.org/standard/754-1985.html): > When rounding to nearest conversion from binary to decimal and back to binary shall be the identity as long as the decimal string is carried to the maximum precision specified in Table 2, namely, 9 digits for single and 17 digits for double. ### Reference * "IEEE Standard for Binary Floating-Point Arithmetic," in ANSI/IEEE Std 754-1985 , vol., no., pp.1-20, 12 Oct. 1985, doi: 10.1109/IEEESTD.1985.82928. cc @tqchen @junrushao1994 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
