- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
#define frist second
It's a bad idea to sabotage the product. If there was enough evidence for damages, Bob can face a big lawsuit.
Admin
OK, what Bob did was inexcusable (sabotaging your employer's systems????), but this is TRWTF. It suggests strongly that these reports were somewhat like what I call "Old Fred's Report" - the thing that opponents of informatic upgrades (especially initial computerisation) usually wave at the upgraders. "It has to be able to produce Old Fred's Report" is the battlecry, and of course:
Nobody, not even Old Fred, reads it.
Nobody except Old Fred knows what he does to produce it.
It's largely meaningless, and it was even largely meaningless when he began producing it when he was Young Fred.
Nobody, not even Old Fred, reads it.
But if the new system cannot produce Old Fred's Report, it will be condemned as useless.
Admin
Ugh yeah we have some level of this at my work. Any change or major upgrade has to preserve existing functionality, even if that functionality is 10 years old, specced by one customer and that customer probably no longer cares and won't take the upgrade anyway.
Admin
Maybe Wirecard will claim this was happening at their place and the billions went missing due to floating point inaccuracy and rounding errors.
Admin
I think the real WTF is not that #define but that a financial reporting system uses floating point to represent money in the first place and relies on doubles to have sufficient precision.
Admin
Ok, this is sabotage and the asshole should pay for it in money and time served.
Admin
My thoughts exactly
Admin
You forgot:
Admin
Maybe they don't use floats for currency. The old integers for dollar and cents. Instead floats are used for something else, like allowable levels of cyanide per ton of rice.
Admin
I remember some shitty project to "streamline" data entry in a dusty corner of the company, data entry is, actually a couple of poor shits who had to sit and read print outs from one system, do something with it in excel, and type the results back into some other database. "Streamline" amounted to shifting the donkey-work over to another team in another dusty corner to no apparent benefit, for reasons I never discovered.
Clearly the project was a triumph of dumb-assery from a bizziness anal-ist who should be kicked a long way away from keyboards so he could do less harm, but I wasn't too concerned, I'd been told to do it, so that was SEP.
I reasoned to regression test this properly (and save another embarrassing deployment rollback as the true impact emerges after the fact) I should at least check where this data was going and make sure there was nothing quirky or unexpected going to bite me. I found a convoluted process where actually several other people were transcribing/adjusting the data before it was finally assembled (manually) into a Excel spreadsheet and emailed.
What I found was an "Old Fred" report where Old Fred was the previous Finance Director of 4 years since. The current Finance Director said "I have no idea what he was looking at that thing for, all the information is on the dashboard, I just say thanks and delete the email once a month".
This untangled an octopus of data manipulation and entry across the organisation that amounted to about 1% of the headcount devoted to Old Fred's monthly spreadsheet, which had not been required for 4 years at least, and was possibly never even needed anyway.
The bizziness anal-ists hated me for that one. No need for sabotage in that outfit, I don't think I could have topped their self-inflicted harm.
Admin
If that were the case, then there's no problem. The OP redefines a double as a float, not the other way around. And frankly I have a hard time believing that the ratio of toxicity to volume needs quite that level of accuracy in a financial context. (A quick and probably incorrect calculation suggests twelve bits of accuracy even on a 32 bit architecture, depending upon the tolerance point.)
Granted, there might be Stupid Regulatory Requirements.
I can't even see this as a problem with ordinary financial transactions. If you've already committed to the loony representation of discrete integer sets (dollars, cents, 1/100 cents) etc as a double, of all things, then you're already screwed. In a sense, redefining a double as a float just makes this more obvious, which is a Good Thing. And probably, on the face of it, a very cheap test.
Then again, it all depends upon proper numerical analysis, which none of us do these days. It's quite possible to feed the results of (say) a chemical reaction through several stages, each of which loses a little bit of precision compared to the last. In which case, redefining double as float is very definitely important.
But in the financial domain? Hardly. These "unexplained" problems are more likely the result of something else, such as a complete lack of testing or the botched integration of third party software (quite possibly from an acquisition). I've been there, both times.
Then again, there's no excuse for sabotage. Hang Draw And 0.244444449 them, I say!
Admin
Too may fours, not enough nines. Sigh.
Admin
Having been a Young Fred at one point, I think I can provide some insight into how Old Fred's Report gets made.
Yes, I created Old Fred's Report. No, I never read it.
Why did I create Old Fred's Report? I didn't mean to, not really. I just wanted to make Old Fred's Regex. Fred's team was asked to take on duties from another group & use that group's ticketing system. But that system doesn't allow Fred's team to grab tickets.
So Young Fred created his regex, which scrapes a website & alerts you to whenever a new ticket comes in. Fred's team can grab the alert, which prevents effort duplication & saves tens of manhours per week.
Fred pitches his idea to his boss, who says that she likes the idea but can't justify the expense.
Fred, thinking on his feet says, "It can also produce Old Fred's Report! When someone calls & says they never got the message about the ticket being done, we can look at Old Fred's Report & show them exactly when the message was sent, by whom, & what it said!"
Fred's boss perks up at that idea. She rarely gets pushback on these tickets but when she does, it's a job-threatening crisis. She approves Fred's requests.
For a couple weeks, whenever there's pushback, Fred's boss refers to the report. Word gets out that Fred's team has the receipts so people stop pretending they never got the messages. Fred's team saves a ton of manhours & gets more work piled on them.
Fred's a bit older, & it's upgrade time. There's only one problem: The new system can't run Old Fred's Report! If they get rid of that, there's no justification for keeping Old Fred's Regex! Fred's team will instantly have to do hours & hours more work every week, but they don't have that time now that they have the added work!
Admin
It's entirely possible that errors caused by using a float instead of a double would take a long time to find out. The error would be small already (I think a float gets you around 8 digits of precision) so it can take a little while for the errors to compound into something big. This is especially true if the operations were done right so you preserve as many digits as you can (there are some order of operations that can drop you from 8 digits to 2 digits if you aren't careful, but can preserve 6-7 digits if you are).
And if you are eyeballing hte numbers, it's entirely possible taht if done correctly it wouldn't be noticed because the error is so small that general sanity checks will pass it.
If done right, it could've been years before it was noticed.
Admin
You forget sometimes the user is the problem.
We once had to implement Black Scholes with an 10 digit truncation after every step so that the results would match the results from the user's HP-12c.
(And yes we did try and explain it to them).
Admin
IEEE floats have 24 bits of mantissa (one is implied), so for money-related applications, it affects any amount more than 16,777,215 of the finest-grained quantities you store. If you store centi-cents, then that's the finest-grained quantity, and 16,777,215 centi-cents is $1,677.7215 (or 1 677,7215 € if we're talking about euro-cents rather than dollar-cents). If it's cents rather than centi-cents, then the limit is $167,772.15 (etc.). If whole units are dollars, with fractions for cents, then the limit for the accurate representation of money is still $167,772.15.
There's plenty of businesses for which the inability to accurately represent money amounts above a hundred and sixty seven thousand dollars would be a critical failure of the system.
Admin
TRWTF is C for including a macro preprocessor that allows a single line of code buried in an include file nested several levels deep to completely change the meaning of language keywords or wreak havoc in other ways (sometimes maliciously but often accidentally)
Admin
@Tim: In other words
Admin
I miss the days of "full contact engineering". Head Slaps (such as Gibbs on NCIS) were a reality. I was the subject of many (mostly deserved). Then they hired someone who would work for me...and policy changed......NOT FAIR!
Admin
It's not just a question of whether there are enough bits in the mantissa. Off-by-one errors are inherent whenever floating point is rounded off to a decimal. In science and engineering, this does not matter; most of the numbers derive from measurements, which cannot be infinitely accurate, so all calculations should include an error bar, and the last digit is never exact.
But accountants live in a fantasy world where the numbers are exact to the last cent, and a calculation done two different ways should give exactly the same result. This gives them three shortcuts to manually check calculations: estimating the magnitude of the result, casting out nines, and calculating just the last digit. In floating point, only estimating the magnitude will work, because the others depend on every digit or the last digit being exactly the same. When money is involved, being off by one cent in a million dollar account might be meaningless, or it might be a symptom of a huge skimming operation.
So for monetary calculations, use very long integers to represent the number of cents, and make sure rounding fractional cents up and down exactly match how your accountant would do it manually,
Admin
This revenge is not "pointless", it's clearly full of points. Just lookit 'em all floating in there.
Admin
WTF? What kind of story is this?
Admin
Jan, could you give me an example where double doesn’t work, for example if you represent dollars as whole cents in double precision? Exact up to 2^53 cents = 80 trillion dollars.
Admin
We do, but for simulations (basically solving masses of simultaneous differential equations) and numerical analysis is vital to ensure that we don't drift out of true due to what are basically quantisation effects. We have an actual mathematician who specialises in that sort of thing on staff (part time).
The problem with using any sort of ordinary floating point for money is that the sum of a hundred loads of $0.01 isn't exactly equal to $1.00 because the former figure isn't accurately representable. It probably doesn't mean that the overall sum is a lot out, but it does particularly matter for situations where you change what you do depending on a threshold value. There are several ways to fix this; doing money handling in fixed point is likely the easiest one.
Admin
Ok, this is justified sabotage and the asshole company deserves this.