There are certain problem domains where we care more about the results and the output than the code itself. Gaming is the perfect example: game developers write "bad" code because clarity, readability, maintainability are often subordinate to schedules and the needs of a fun game. The same is true for scientific research: that incomprehensible blob of Fortran was somebody's PhD thesis, and it proved fundamental facts about the universe, so maybe don't judge it on how well written it is.
Sometimes, finance falls into similar place. Often, the software being developer has to implement obtuse business rules that accreted over decades of operation; sometimes it's trying to be a predictive model; sometimes a pointy-haired-boss got upset about how a dashboard looked and asked for the numbers to get fudged.
But that doesn't mean that we can't find new ways to write bad code in any of these domains. René works in finance, and found this unique JavaScript solution to converting a number to a negative value:
/**
* Reverses a value a number to its negative
* @param {int} value - The value to be reversed
* @return {number} The reversed value
*/
negateNumber(value) {
return value - (value * 2);
}
JavaScript numbers aren't integers, they're double-precision floats. Which does mean that you could exceed the range when you double. That would require you to be tracking numbers larger than 2^52, though, which we can safely assume isn't happening in a financial system, unless inflation suddenly gets cosmically out of hand.
René has since replaced this with a more "traditional" approach to negation.