$110 million lost because software could not cope with negative numbers

https://www.bloomberg.com/news/articles/2020-05-08/oil-crash-busted-a-broker-s-computers-and-inflicted-huge-losses

Don’t buy oil at 1 cent per barrel - that gift horse IS too good

Is the opinion that Julias type system would have saved the day here - even if a type was chosen which was not appropriate?
Looks like the price was able to go negative. but the display value not able, and also the margin calculation was wrong.

More serious question - the article clais a default display value of 1 cent. Does anyone really put in default values like this, rather than erroring or displaying ERROR, NaN, or something like that?

1 Like

From the article, it looks like a display issue. I am not sure how you expect Julia’s type system, which is not that different from other languages when it comes to primitives for number types, would change anything. But it is hard to say without the code.

Generally, I am not sure it helps to promote Julia by claiming that it would have eliminated some bug for which we know nothing about the details. Yes, no, maybe. No one knows. Bugs like this happen in Julia code too, it is not magic.

14 Likes

Tamas, you misunderstood my point. But I did not make a clear point I admit.
Yes - how can a type ssytem fix a problem like that. I was just looking for interesting answers.

I think about this article whenever I read about one of these big software failures: https://www.fastcompany.com/28121/they-write-right-stuff. It seems like there are ways to cultivate process and culture to write correct code, but they aren’t used much. But also I’m sure it’s slower and more expensive, and maybe that’s a factor too.

It seems like in this case just running tests with corner cases would’ve found the bug.

1 Like

Well, as i said tongue in cheek. Julia’s type system can help with a lot of issues eg https://youtu.be/n4leHwOfHBs

I think it is good to echo @Tamas_Papp’s word here:

Yes, it is possible to define units (with promotion) in the type system of Julia but so is it in most languages. NASA even has its own unit library: https://github.com/nasa/libSPRITE.
Personally, I think videos like this might cause more harm than good since most reactions tend to be quite negative if you don’t do a really good job showing exactly how the bug would have been prevented and that you have in-depth knowledge about how the bug happened (cf https://www.reddit.com/r/Julia/comments/g0gr86/how_nasa_could_have_prevented_a_200m_crash_with/).

3 Likes

More than that was lost in 2007-2009. Mortgage-backed securities were priced using the rating agencies risk models and the models did not allow for negative home price appreciation (HPA). They assumed home prices can only go up :man_shrugging:

When I joined Countrywide in 2007, the team was frantically trying to recalibrate the models and one of the hardest parts was running the model with a negative HPA :man_facepalming:

1 Like