- 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
Given the context of the code, PI looks more like an acronym than a representation of the mathematical constant. The WTF is on you.
Admin
No, the Irish girl is a nice piece of pie and my PI (make up your own meaning) goes to twelve (add appropriate units) when I see her.
Admin
Admin
hey you stole my idea for my next mfd comment submission. now everyone will think i stole it off you...
Admin
You have NO idea :)!
Admin
Likewise, I advocate that java.lang.Math.PI should be changed to java.lang.Math.RATIO_OF_CIRCLE_CIRCUMFERENCE_TO_CIRCLE_DIAMETER
I know it's longer to type, but scientists and mathematicians using Java (both of you) are just going to have to suck it up.
Admin
Admin
Of course, from a British point of view trwtf is that the class is called Math. Everyone knows it should be java.lang.Maths ;^)
Admin
Admin
... and even if it means the Greek letter, the value 12 is clearly meta data saying "this value is a PI", it's not data giving the value of PI.
this one is not a wtf at all
Admin
All comments referring to The Girl Formerly Known As Erica are missing the point. There is no such thing as Indiana PI. There is no such thing as Irish PI.
There is only American PI.
Addendum (2008-03-13 13:05): I'll accept Mississippi Mud PI, because that's qualified by something to do with dungeons. Difficult to confuse that with mathematical equations, really.
Admin
And, this looks to be the equivalent of an enumeration, so the value that the enumeration elements take on isn't intended ever to be used in arithmetic expressions.
So is this an instance of the post here being funny because the person who submitted the screenshot is clueless?
Admin
Doesn't every sane IDE and compiler support Unicode by now? So why don't people simply use public final static int π = 12 instead of transcribing the letter the a latin alfabet?
Admin
MAYBE IT'S PI ROUNDED OFF IN BASE 3.
Admin
Mmm... twelve pies
Admin
The fact that Java's enum is a WTF of itself is beside the point here.
Admin
(sorry, gave up trying to find a larger version)
Admin
La-ame. And to all those who suggest Java should have used something more descriptive than PI, perhaps, but in the context it should be clear. And a quick web-search of SGML PI will turn up ample evidence that usage of PI when dealing with SGML is common, not obscure. Or are you all people who always spell out other abbreviations like XML, or DTD, etc...? Thought not.
Admin
Is this value a reference? Is it a bird? Can it jump tall buildings in a single bound?
If I use the correct magical incantation (no doubt using plenty of XML and introspection), would invoking the metadataic "12" give me 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019? And is there metadata to apply to the metadata, in order to tell me that I'm slightly wrong (as opposed to 12 being completely wrong)?
Lord, take me now. I need the Rapture.
Admin
What exactly are the common interpretations of "XML" and "DTD"?
Admin
Admin
I think we should hire Magnum, PI to investigate!
Admin
Not really; they just realized that making a wheel one unit in diameter and rolling it once along the ground made a line that was a little more than three units long. It's not clear that they even realized that it was always exactly the same ratio.
Admin
Good luck: http://www.collegehumor.com/article:1716262
Admin
So you must have a Magnum PI, huh?
Admin
...oops. Christophe beat me to the pun.
Admin
My first reaction (as a java dev) was, what the hell is this for. When I saw that it was to do with DTDs, I my second thought is "What ignorant f$cks don't know what a processing instruction is?"
Admin
Maybe I'm just bogging the general fun down with a religious discussion, but I always get a laugh out of the people who say that "the writers of the Bible thought pi was equal to 3" because there's a mention of a round object having a diameter of 10 cubits and a circumference of 30 cubits, and then ridicule the Bible for being unscientific.
Umm, have you ever heard of "round numbers"? Really now. If the writer had said that the diameter was 10 and the circumference 31, someone could have protested that he should have said 31.4. If he had said 31.4, they could have insisted he say 31.42, etc forever. Pi is a transcendental number, which means that it cannot be expressed exactly in any finite number of digits. The only way to EXACTLY express the value of pi is to say "pi" or give a formula.
Do you think that even the most rigorous scientists never says something like "I live 5 miles from the lab" when REALLY she lives 4.93 miles away? As I routinely delight in telling my daughter every time she asks me "exactly" what time it is ... there is no such thing as an exact measurement. There is only a measurement accurate to a specified level of precision. Someone else could always come along with a more accurate measuring device then whatever you used.
</diatribe>Admin
If it's the Greek letter, then the value should be 960. At least, that's what Unicode says.
Admin
As someone mentioned, if you import both Math and ... whatever that other class was ... into your Java program and try to reference PI, the compiler will give you an error. The dangerous problem would be if you imported the other class, never imported java.lang.Math, and then without thinking tried to use PI. The compiler would accept it, but you would get incorrect results. Well, if you were lucky the compiler might still reject it because you're trying to use an int in a floating point calculation without doing a cast. But as I presume it would be used in some more complex formula, you might cast it anyway, or respond to the error by slapping casts on without thinking about it.
I've gotten burned by this a few times over java.lang.util.Date versus javax.sql.Date. You can get some very subtle bugs. Other than saying "never ever use the same member name in two different classes" I don't know how you'd avoid the problem, and that seems a rather drastic solution.
Admin
Pi is actually variable in a relativistic rotating frame due to distance dilations. At a speed that is a significant fraction of the speed of light, pi does become 3. Now that's some spin.
Admin
java.sql.Date is the bane of my existence. It exists for no apparent reason (after all, there's no special java.sql.String) and, most annoyingly, appears BEFORE java.util.Date when sorted alphabetically. This means whenever using a Date in an IDE that supports automatically generating imports (a godsend, generally), you always have to manually select java.util.Date instead of java.sql.Date.
Even better, though, is that java.sql.Date doesn't work like java.util.Date does. java.sql.Date is only a date (year/month/day), which java.util.Date is a millisecond timestamp. So if you accidentally use the wrong one, be prepared to lose your time information!
JDBC is worthy of a WTF article in and of itself. Not only is it split between java.sql and javax.sql, Sun keeps on !@#$ing CHANGING THE DAMNED INTERFACES BETWEEN JAVA RELEASES!
Which means that Sun themselves use a preprocessor (which, of course, Java doesn't support) in order to allow their own JavaDB JDBC driver to compile for different JDBC versions.
Which means that JDBC drivers aren't forwards compatible with new JRE versions. Try and run a JDBC driver for JRE 1.4 on a 1.6 JRE, and you'll get some java.lang.LinkageError.
Ugh. The only thing worse than dealing with JDBC is dealing with Swing. And the only thing worse than dealing with Swing is dealing with anything J2EE. Why won't Java just FREAKING DIE ALREADY?!
Admin
Admin
The conclusion Solomon thought PI to be 3 is wrong.
http://www.purplemath.com/modules/bibleval.htm
Admin
Can I jump on the this-is-stupid-train too? Because this article is stupid.
Admin
http://archives1.twoplustwo.com/showflat.php?Cat=0&Number=12873365&page=0&fpart=8&vc=1
Admin
I think the Irish girl has to PI
Admin
Dammit, they found a way to beat AdBlock... Irish girl
Admin
Not so much a wtf?
Wouldn't it be a stupid idea to have Pi declared as an int anyway? The poster should have noticed that.
Admin
Mind you, they don't really help with irrational/transcendental numbers.
Admin
I'm with Websense Hater, Eyrieowl, and mjs.
This is a lame article. The reason is is lame is because context is deliberately witheld to be misleading.
"PI" is the correct name in this context, and the only way someone could get tripped up is if they forgot to import the real math stuff... Which of course they would have to do if they wanted to do anything truly interesting with the numbers.
It's not a language problem if a programmer can't mentally remember to import the proper namespaces. The whole REASON for namespaces is to make these kinds of collisions acceptable.
They should be blindingly obvious interpretations in the necessary context of computer science, and more obvious by at least an order of magnitude when used together.Admin
worst. wtf. ever.
Admin
The whole REASON for namespaces is to disambiguate between these kinds of collisions. That is not at all the same thing as "acceptable."
The semantics of namespaces are a pitiful defence when you're trying to explain why you chose to enumerate "Pompous Idiot" (eg me) as "PI" rather than as "TWERP."
I can't even be bothered to check in my handy Wikipedia, but AFAIK, maths has no common terms labelled XML, DTD, or TWERP.
PI, on the other hand, has an almost universally recognised documentary significance. Feel free to abuse it. Expect, however, that maintenance programmers such as myself will call you an XML or a DTD. Or even a TWERP.
Admin
I don't understand why you're so hung up on the fact that nobody has defined constants for those items in the math package.
But fine, replace "acceptable" with "manageable".
Of course, by your logic, EVERYBODY should also share state constants, like Foo.READY and Foo.ACTIVE, since those words are also candidates for repetition? In fact, they're far more likely to be repeated in different namespaces than "PI".
So obviously nobody is allowed to use them?
Admin
TRWTF is that I'm still waiting for the MFD!!!
Admin
What's even more fascinating is that a lot of the maths that we learn in school (or at least back when I was in school) was first done (afawk) by ancient Greek philosophers like Pythagoras, Archimedes and Euclid.
Admin
Prior to Java 5 and the introduction of "import static", the mathematical pi would always be "Math.PI" because there was no other way to refer to it. (Pedants should note that Math is a final class before suggesting someone could extend it.)
DTDConstants on the other hand makes use of a somewhat braindead workaround, defining constants in an interface that can then be implemented to get the exact same effect as "import static".
In any case, the chances that anyone would mistakenly use the DTDConstants.PI constant is extremely slim since it's only used for parsing HTML within Swing - a library that's a giant cluster of WTF by itself. Really these classes shouldn't even be part of the API, since they're tied so strongly to Sun's implementation.
In non-Java languages where the math constants can be referred to in a sane fashion, naming a constant "PI" is just brain-dead. But this is Java, and referring to things by an overly-long namespace is normal.
Admin
The semantics of namespaces are a pitiful defence when you're trying to explain why you chose to enumerate "Pompous Idiot" (eg me) as "PI" rather than as "TWERP."
I think the both of you missed the boat on Eyrieowl's comment (or DHager for certain). He wasn't saying that there were common terms labeled XML and DTD, he was saying that there WEREN'T. His point was that since PI is a VERY common term it would be stupid to use it anywhere else.
Admin
Long tradition. It's customary in SGML jargon to refer to an SGML processing instruction as "PI". (FYI: it's the <?thingy?>)There's no arithmetic involved in SGML so conceptually there's no clash. Besides "processing instruction" is a heck of a long identifier. The SGML jargon is full of cryptic 2-4 letter abbreviations already.
Admin
Or, you could stop being a twat and just tell her the time.