21 points

The Vancouver Stock Exchange’s Rounding Error that Dropped the Market Value by Half


dashboard

Sun Jan 12 2020 17:40:37 GMT+0000 (UTC)

Posted by @chrissyjones #historicalcode #numbers

- return floor(value)
+ return round(value)
content_copy

In early 1982, the Vancouver Stock Exchange unveiled an electronic stock index initially pegged to a value of 1,000 points. In two years it dropped to half its original value—a confusing trend amid the bull market of the early 1980s. An investigation revealed that the calculations of the index were wrong in just one command, using floor() rather than round(). This command meant that instead of rounding to the third decimal place, the value was being truncated. (Digital computers necessarily have finite resolution, which necessitates rounding or truncation.) So if the index was calculated as 532.7528, it was stored as 532.752, rather than rounded up to 532.753. Over the course of thousands of calculations a day, this seemingly minor difference—essentially rounding down every single time—amounted to a dramatic loss in value. The programming mistake was finally fixed in November 1983, after the index closed around 500 on a Friday. It reopened on Monday at over 1,000, its lost value restored. —Lav Varshney, assistant professor, University of Illinois at Urbana-Champaign

https://slate.com/technology/2019/10/consequential-computer-code-software-history.html

>> Browse more code snippets

more_vert