-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] Print doubles with precision 17 in SaveJSON and TVM script printer #7846
[BugFix] Print doubles with precision 17 in SaveJSON and TVM script printer #7846
Conversation
Thanks for fixing the subtle issue! BTW, would you like to also fix the TVM script printer? |
Okay, I'm gonna to take a look soon. |
@junrushao1994 I've fixed the TVM script printer. Would you like to take another look? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. CC: @Hzfengsy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @Hzfengsy @junrushao1994 |
…rinter (apache#7846) * [BugFix] SaveJSON type double with precision 17 * [BugFix] Fix for TVM script printer
…rinter (apache#7846) * [BugFix] SaveJSON type double with precision 17 * [BugFix] Fix for TVM script printer
…rinter (apache#7846) * [BugFix] SaveJSON type double with precision 17 * [BugFix] Fix for TVM script printer
…rinter (apache#7846) * [BugFix] SaveJSON type double with precision 17 * [BugFix] Fix for TVM script printer
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:
Reference
cc @tqchen @junrushao1994