$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: They Write the 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 How NASA could have prevented a $200m crash with Julia - YouTube

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: GitHub - nasa/libSPRITE: libSPRITE is a set of libraries that have been used on several past projects including flight, technology demonstration, and simulation projects. libSPRITE provides a diverse set of functions to attempt to simplify coding and reduce code errors. For example, libSPRITE defines engineering units as types (i.e., Meters or Radians instead of double or int). It includes an engineering unit aware math library. libSPRITE includes a task scheduling system that abstracts pthreads and includes a publish subscribe data system for data routing. In addition, libSPRITE includes an optional binding to the Lua scripting language for configuring the program, setting parameters, running Lua scripts within C++ tasks and even interacting with the application during runtime..
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 Reddit - Dive into anything).

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