Clia was handed a pile of legacy code and told to upgrade it, but with a very important rule attached: the functionality couldn't change. Any change could break someone's workflow, and thus in the upgraded system, even the bugs had to be reproduced.

Unlike most "legacy" code, this wasn't all that old- it was written in C#. Then again, C# is old enough to drive, so maybe it is old. Regardless, C# has utility methods, like, say, a ceil function. At no point in C#'s history has it lacked this basic functionality.

That, of course, doesn't stop people from reimplementing it badly.

nToken = (nArea / 12).ToString(12).Tokenize("", ",", sToken);
nValue = sToken[0].ToNumber();
nDezimals = ("0," + sToken[1]).ToNumber();
if (nDezimals > 0.0001m){
nValue = nValue + 1;

Note, this isn't a function. This representative snippet is the pattern that was copy/pasted, with modification, anywhere someone needed the ceiling of a value. Clia dutifully replicated its behavior, unchanged.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.