- 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
Surprisingly, the United States'. http://en.wikipedia.org/wiki/Calendar_date#mm.2Fdd.2Fyy_or_mm.2Fdd.2Fyyyy_.28month.2C_day.2C_year.29
That's the great thing about standards, there are so many to choose from.
Admin
Admin
Well, at last this approach is well scallable, it could be setup as a integer division cluster!
Admin
Admin
Admin
No, its more like catching the fly and putting it in a box that you then post to your accountant with instructions for him to swat the fly and send it back to you.
Admin
I almost took a job where only IT guy was leaving.
In about 3 days he was trying to train me to do a quite lengthy process that was only documented in his head and on random documents. He was leaving the U.S. for the U.K. for his new job. No one else knew how to run the system.
The job consisted of a Java with SAS and a webserver. The Java part was written by a 3rd company in FL and got slower and slower as more data was entered (via users by a MS access application and various spreadsheets). And there was no backup server. :)
Admin
Not a WTF at all. The next expensive upgrade to sell, with dramatic performance enhancements, is only ten minutes' work away...
Admin
I have to admit, I have written my own divide/remainder functions before, but that's because the default operators in most languages don't follow the correct mathematical convention for negative numerators.
Admin
Small wtf: [quote] Yes, Aaron made a call to SQL Server, and filled a DataSet just divide two integers! I guess Math.Floor(Num / Denom) was too easy. [quote]
We all know that an int divide doesnt need to be floored right? Because an int divide dismisses the numbers after the seperator (9/4 = 2.25 but in int divide that is 2 (note: not rounded 7.9999 would become 7).
So the floor would be redundand. All he needed was Num / Denom. And at first some check to see if denom wasnt 0.
Admin
Another case of "Man who owns only a hammer" syndrome? I know someone who uses Excel to write press releases.
Admin
Wait what?
Admin
Admin
That doesn't supprise me. In the company where I work excel is used for everything from data storage to bug reports (even though we have proper database and bug reporting solutions in place - they just don't get used).
Admin
Yes this is true. The author of this article's WTF code is a terminator of common sense and basic logic.
Admin
Come on, we all know America is too retarded to come up with a date format that orders each component by significance. That would be, you know, sensible and everything.
Admin
Admin
"When all you have is a hammer, everything looks like a nail".
I worked with someone who was adamant that:
I pointed out that:
At that point, his eyes glazed over...
Admin
FTFY.
Pesky accountant, never does as he's told.
Admin
This is just lame. Everyone knows that division is a slow operation. He had to create a table on that server, with 3 columns: numerator, denominator, result, to cache the results of frequently used divisions. And if there is no entry for given parameters, only then it should actually divide (and store the result in the table). There could be a stored proc for all this logic.
Admin
Admin
The USA date format of Month/Day/Year appears to have evolved (devolved?) from the common US written form: Month Day, Year. (E.g. June 10, 2009.)
Of course, it is not entirely uncommon (at least in US English) for the comma to indicate that items have been transposed. Thus, "Doe, John Alva" would represent "John Alva Doe" and "Boring Book Title, The" would represent "The Boring Book Title". In this way, the date may have originally been formatted as "2009 June 10", but was reordered so as not to begin with digits.
Admin
The real WTF is he didn't put the ds.tables(0) into a With...End With block. Geeze, doesn't he know anything about speed optimization?
Admin
And then, of course, as the masses became literate and were taught how to write dates but not why they were in that order, it just sort of stuck.
Admin
.NET doesn't do NaN, it would just throw an exception. DivideByZeroException, in fact.
Admin
I have, at work. My predecessor also had an interesting approach to programming. This is what happens when you hire an economist (now financial lawyer) to write code for you.
Admin
I just tried this out in VB.NET (The original code looks like VB.NET to me), the following code gave me "Uhoh, a System.OverflowException was thrown!"
Whereas this code gave me "It worked, the answer is: Infinity":
Admin
.NET does indeed speak NaN
http://msdn.microsoft.com/en-us/library/system.double.nan(VS.71).aspx
Admin
Chucktober!
Admin
Nah, there's too much difference in power there. A rubber mallet would be a better fit.
Admin
Sugust!
Admin
That's amazing! I've got the same combination on my luggage!
Admin
DMY? I know what that means, young lady!
Admin
Well, at least it got the answer right on the second piece of code. Even though I don't think that you can continue to compute with the 'Infinity' it gave as a result.
Actually x/0 returns "Complex Infinity" (a quantity with infinite magnitude, but undetermined complex phase) http://www43.wolframalpha.com/input/?i=123%2F0
where as log(x/0) returns "Infinity" http://www43.wolframalpha.com/input/?i=log%28123%2F0%29
What would vb.net return if you tried to take the log of 'result' in the above example? ...
better yet, try 1/result which should return 0.
Admin
there's a perfectly valid reason for doing this you've all missed. if the application was a database based application that could use multiple providers, each of which performed integer division in a different fashion, and you wanted to ensure that whatever database you used, the integer division within the app was done in the same way as the database, this would be the way forward.
of course, you'd be better off going home.
Admin
== "It worked, the answer is: Infinity"
== It worked, the answer is: 0
Admin
Yes, that's great, but I'm guessing that Google is not using SQL Server to perform it's equations. I want SQL Server quality answers, not just some answers produced by a puny on-chip floating point processor.
Admin
Good god, I'm blown away. Is this really the way .NET handles div by zero operations?
My background is physics/math so yes I do understand why/when these answers can be considered valid or can be useful, but I sure as hell don't want my app to contine happily along without throwing an exception...on the x/0 operation...if the code happens to try dividing by zero!
If I was coding in mathematica or maple I'd expect the advanced behavor, but not with a 'traditional' development platform!
Holy crap! That just seems like a problem waiting to happen...
Admin
The 0/0 indeterminate is funny, because business specifications usually want it to resolve to something that's still a metric. In the case of percentages, I run into "if zero met the test out of zero cases possible, then we want that to read 100% compliance."
Admin
Admin
When will we see some more of that guy's work. Tomorrow ?
Admin
Febtober!
Admin
They make the facts and figures he quotes more valid.
Admin
Sheesh. I feel foolish now... I was having trouble figuring out the WTF when I read the article. I'm so glad I read the comments now so that I could be better edumucated.
Admin
Thanks, Dinnerbone ...
What about on the first try
I am curious (I should just install vb.net here) that result can carry around Infinity as an answer.
So what is the proper way to do this? CInt throws an exception, so I suppose that would be the right function to use (if you didn't want a complex answer).
I agree that even though the results are correct, and this is just mental fun and games right now since the original code checked for a 0 in the denominator, that I would want some sort of exception, usually. Wouldn't you?
Admin
Umm, what calendar do you? Mine only goes to 12.
Admin
Umm, what calendar do you? Mine only goes to 12.
Admin
Argh, that should be:
Admin
Hehehehehehe, heh!
The story was funny, but this point really made me crack up :-)
Admin
Nice troll attempt