 Feature Articles
 CodeSOD

Error'd
 Most Recent Articles
 Zeroics
 Not Really an Error'd Error'd
 Twicely Done
 Fresh Bugs
 Absolutely Execrable
 Boy Howdy
 NaaN
 Bon Weekend
 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
Admin
Isn't the answer "File Not Found"?
Admin
Admin
lim(x>0) sin(x) / x = 1
lim(x v 0) e(x) / x > INF
lim(x ^ 0) e(x) / x > INF
Division by zero is just totally undefined.
Admin
FTFY.
Admin
Admin
Clearly the PHP god is a Trinity. It's obvious he could also make 3===1.
nimis: Sure glad we didn't hire PHP god. That was a ni`mis.
Admin
For reference, here is what happens when it is executed...
Admin
Holy fucking Jesus on a bicycle. I feel like this code has just raped my mind.
This is probably the worse code I've ever seen here because rather than just being plain stupid or wrong, it's deviously stupid and wrong on so many levels.
Admin
I don't "do" PHP, but I'd propose a solution like this:
Admin
or else Renormalise :)
Admin
Admin
I propose a solution of Napalm with a bit of nerve gas included. That way, he will lose control of most orifices while he writhes on fire. but that's just me
Admin
I think you'd just have to go:
Value taken from Java documentation for 64bit fp, couldn't find for php.
Admin
It's all the people in his head getting together to make this monstrosity.
Admin
The one time I remember this coming up was in (wait for it) Fortran. Doing some heavy math computations, I found myself needing the arctangent of some ratio, the denominator of which could be and often was zero. Straightforward calculation of the ratio followed by a call to the ATAN function blew up on the divide, which is where I learned that Fortran comes with another function: ATAN2. Two arguments, such that ATAN2(x,y) is the same as ATAN(x/y), except that when y is zero it returns π/2 (or π/2 if x is negative).
Admin
return $numerator / ( $denominator == "php" ? 1(2*rand(0,1)) : $denominator );
Admin
That's the Omnipotent We. It's similar to the Royal We.
Admin
Admin
Admin
Lol at "somewhat obvious here"
Admin
There are two equivalent ways to do it. Less than 0, or less than or equal to 0. In the first case, it is neither. In the latter, it is both.
No real problem results from this, except that mathematicians tend to prefer defining things in terms of lessthatorequal (because doing so implies certain things about joinlike operations on ordered sets).
Sometimes people prove that a number must be zero by showing that the number is both positive and negative. If the "less than" definition is in place, this is a proof by contradiction (in other words, nonconstructive. A computer can't do it). If the "less than or equal to" definition is in place, it is a direct proof (which a computer can do).
Admin
Admin
Way to nitpick on the ESL student...
Admin
Shit. I meant double.Epsilon (or equivalent in other languages). Smallest positive double value greater than zero.
Man I even fucked up by deliberate WTF, which is TRWTF.
Admin
I'm pretty sure this went into production because the guy spent so much time on it.
Admin
Regardless, if you don't know when to use whom, just use who... that way you won't sound pretentious.
Admin
$x / 0 == undefined, not infinity. You can't even say the limit of $x/$n is infinity as $n > 0 because it's negative infinity coming from the negative side and positive infinity coming from the positive.
Admin
Where $x if positive, of course. If $x is negative, it's the other way.
Admin
[quote user="frits"][quote user="PHP God"]What's all this "we" shit? I can guarantee that no one else was involved in this work of art.[/quote] Work of art? How dare you compare this filth with the likes of cave paintings You do damage to true paleolithic art everywhere.
Admin
I'm surprised the we isn't capitolized
Admin
I can't quite tell if people are trolling regarding what x/0 evaluates to or if they're just stupid.
Seriously people, it's not hard. It's undefined.
Admin
You've described taking the limit from above:
lim[a>0+] x/a = INF
This is nice if you're looking at it from a Calculus point of view. You can also come up with an answer for 0/0 in some cases using L'Hopital's Rule.
However, from an abstract algebra point of view, division is not an operator over the real numbers precisely because division by zero is undefined. Calculus tricks notwithstanding, poor old division still doesn't get to join the operator club.
Admin
Admin
Admin
Admin
Harrow.
Admin
My head asplode.
Admin
I'm sure someone's already said it.
The flowchart does not represent the code properly. Other than there being only 1 false condition in the flow, the loops true and false conditions are missed (the loop exits when $n != 0, not $n==0 (swapping the true/false branches will fix).
This has to be fake  it doesn't even do remotely what it's meant to....
It will work provided $denominator is not 0, but that it is a number.
Admin
Yup. "This is a clever trick' or 'We cleverly....' always starts alarm bells flashing and lights dinging that someone has decided to reinvent the wheel because their blissfully unaware that there is a simpler way to do things (or that there exist libraries to do such things already).
Admin
I would agree with you, except why would you bother commenting it in that case...
This does look fake, and it is possible that some dick did it as a laugh, however the way it is commented suggests to me that the person who did it really was a nonce.
Must admit, tho, that the stupidity of the code does beg the question (oops) how the dick would have gotten anywhere...Maybe he didn't have a degree, or maybe his mates in the union insisted he be hired...
Admin
Let x = 1 => x^2 = 1 (square both sides) => x^2 1 = x 1 (subtract 1 from both sides) => (x1)(x+1) = x1 (simplify LHS  dffierence of perfect squares) => x+1 = 1 (divide both sides by (x1)) => x=0 (subtract 1 both sides) BUT...x=1 => 1=0
QED.
Admin
I can't stand that code... And I can't understand why php allows people to create something like that...
Admin
Plus, comments always have to say "we" no matter how good I am.
When the shyte hits the fan, it's a lot easier to say "WE need to fix this" when the comments all say "we". If they say "I" it means it's my problem...
Admin
turns out that dividing by x1 is only allowed if x!="1php"
Admin
Oh...I always thought it was Kitchen Wall....
Admin
Okay then assume i = sqrt(1) => i = srqt(1/1) = sqrt (1/1) = sqrt(1)/sqrt(1) => i = 1/i => 1 = 1
Admin
Although I agree with "limit as x>0 = sideways 8", I also thought most people accept that we actually get to infinity when the denominator is 0 (although noone really knows where that is  although we can prove that there are inifities of different sizes {the sum of primes is clearly smaller than the sum of Integers, which is clearly smaller than the sum of all rational numbers etc). I thought what they meant there by "no solution" is in fact infinitely many solutions (although I now notice they say "no solutions"  which is more interesting).
Also, I think "The Phantom Tollbooth" is a good book...
Admin
Also, the rabbit was already in the hat, and the woman from the audience that "you've never met" was in the top half of the box the whole time; the feet at the bottom were mechanical.
Admin
Not for the first time, I've wondered whether everyone thinks irony == sarcasm == comedy...