News for hackers. Stuff that matters.
Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by nanis on Saturday October 12, 2019 @07:22PM (#21237048)
You have to dig really hard to find out what the specific problem was. It turns out this was the fix:

    def read_gaussian_outputfiles():
        list_of_files = []
        for file in glob.glob('*.out'):
            list_of_files.append(file)
        list_of_files.sort()
        return list_of_files
That is, the original code never sorted the files and instead it trusted that a simple `glob` would give it files sorted in whatever is the desirable way.

It is a reasonable mistake for a total noob to make (just like the hundreds of simulations which use the built-in `rand` function of whatever language they are using without even so much as mentioning this pertinent fact), this should be called a "programming error" instead of a "code glitch". Also, the error should be publicized up-front.

Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by mxcrossb on Saturday October 12, 2019 @09:57PM (#21237777)
So many comments in this thread are saying that scientists are bad programmers, but even a great programmer can make mistakes like this. The solution isn’t related to better programmers, but instead for users to treat codes as instruments, and hence a verification and calibration step.
Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by fauigerzigerk on Sunday October 13, 2019 @04:11AM (#21239162)
I would say it depends on the thought process that caused the bug. There are a couple of possibilities I can think of:

Did the author of the code simply forget to sort? That's equally likely to happen to anyone.

Did they assume that the sort order of glob.glob() was reliable across different OSs and file systems? I don't think this would have happened to an experienced software developer. At least there would have been enough doubt to go read the first line of the docs.

Did they not care whether the code worked anywhere outside their own personal setup? This is perhaps slightly more likely in an academic environment but I'm not completely sure about that. We'd have to know more about the specific circumstances.

What I find more astonishing is that it took so long for this bug to be found. It's not exactly an edge case or a rounding error. It must have caused wildly incorrect results in many cases.

So I think the more important differences may be on an organizational level rather than a question of individual competence.

Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by zuzun on Sunday October 13, 2019 @03:29AM (#21238986)
A reasonable mistake for all who already used the POSIX `glob` function, which returns sorted paths by default.
Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by dr_zoidberg on Sunday October 13, 2019 @11:22PM (#21245023)
Seeing the code, I don't get why this was encapsulated in a function, considering they don't even take a path argument.

It could easily have been just a oneliner:

    gaussian_outputfils = sorted(glob.glob('*.out'))
Of, if it needed function form:

    def read_gaussian_outputfiles(path):
        return sorted(glob.glob(f'{path}/*.out'))
Re:A Code Glitch May Have Caused Errors in More Than a Hundr... by Someone on Sunday October 13, 2019 @03:21PM (#21242315)
Have you figured out, too, why this gives different results? I can easily imagine that it would affect rounding somewhere, but if so, neither of the numbers in the abstract (172,4, 172,7, 173,2, and again 173,2) is incorrect, and the relatively large range point towards numerical instability of the algorithm.

Secondly, I would guess the reported difference between Mac OS Mavericks and Mac OS Mojave is because they tested on a Fusion Drive (I would expect the filesystem to cause the difference, and that changed with High Sierra, except for Fusion Drives, where it changed with Mojave)