-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
2 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5bebf41
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.
How in the world did you figure this out?
5bebf41
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.
It is deterministic memory reuse, not uninitialized memory, it was repeatable, as long as you printed the right pair of numbers in the right pair of show modes. I ran Jiahao's script in a debugger with:
then would figure out that path it had taken through that function and repeat on the next function a level down.
while doing this on
bignumdtoa
, I noticed that the results were repeatable at the repl, given those locals, but that one of the locals (decimal_point
) was not computed correctly. That meant the bug was somewhere in the initialization code, which is when I eventually noticed how these values are used, and that they weren't being set.As an aside, out show compact code seems slightly wasteful in the number of times it calls
sprint(showcompact_lim,v)
on every cell in the array (3 to 8 times, by my estimate), then uses a regex to determine if it contains a particular character sequence ([.eE]
for Real,[+-]
for Complex,//
for rational)5bebf41
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.
cripes; sorry for the hassle. who knew just using a cache of BigNums would cause so much trouble. It's interesting this didn't result in any errors when running it through the big grisu test suite (which tests 100K different configurations for hte different printing modes).
5bebf41
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.
Is it possible to contrive a test case or two that would have failed before this fix?
5bebf41
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.
no, i was never able to reproduce it without just rerunning Jiahao's script.
5bebf41
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.
@quinnj – do you think you could coax this into hitting those new branches somehow?