• Chris Eldredge (unregistered)

    Given the context of the code, PI looks more like an acronym than a representation of the mathematical constant. The WTF is on you.

  • Slurper (unregistered) in reply to Anomynous
    Anomynous:
    Mmm... Irish girl

    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.

  • (cs) in reply to Paolo G
    Paolo G:
    WhiskeyJack:
    [

    Actually, I just find it fascinating that even in ancient Biblical times they already knew some of this stuff.

    They didn't.

    The ancient Egyptians had a fairly accurate value of pi
  • The real wtf fool (unregistered) in reply to OzPeter
    OzPeter:
    MFD comes out on Mon, Wed and Fri. And how come no one has submitted a MFD comment that was printed out, put on a wooden table and photographed???

    hey you stole my idea for my next mfd comment submission. now everyone will think i stole it off you...

  • Me (unregistered) in reply to Sionnach

    You have NO idea :)!

  • Some Funny Troll (unregistered) in reply to MET
    MET:
    I think this is a big WTF. All it takes is for someone to statically import these constants, which could be done for some other values without realising PI is present. Then they have a golden opportunity to shoot themselves in the foot by then referring to PI and expecting 3.14... . One of my golden rules of programming is to do things in a way that gives users of my code the least chance to get it accidentally wrong - partly because I may be the one who ends up tripping over obvious issues such as this.

    I realise this natural conclusion of this argument would be that all constant names must be unique everywhere, which is obviously untenable. I do think however that PI is a special case as it is the one programming constant that all are familiar with a priori.

    Anyway, why not use moderately self descriptive names like PROCESS_INSTRUCTION rather than the cryptic PI.

    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.

  • (cs) in reply to D2oris
    D2oris:
    /knows Pi to 50 decimal places...somehow
    [image]
  • JimM (unregistered) in reply to alyawn
    alyawn:
    TRWTF is the import package.class.* "feature".
    I'm inclined to agree, although you don't even need the .class. in there - the * is the WTF. I like the idea of static imports as in e.g.
    import static java.lang.Math.PI
    if you're going to be doing a lot of calculations involving Pi in the class (because yes, PI is a lot quicker to type than Math.PI), but allowing
    import static java.lang.Math.*
    , or (IMNSHO) worse
    import javax.swing.*
    is asking for trouble (do you know all of the static constants and methods available in the Math class? And all the classes that exist in the javax.swing package? 'Cause I don't).

    Of course, from a British point of view trwtf is that the class is called Math. Everyone knows it should be java.lang.Maths ;^)

  • Anonymous Coward (unregistered) in reply to Theo
    Theo:
    PI is only two letters. What are the chances someone use it elsewhere with a different meaning to the mathematical PI? Huge.
    Ummmm, 100%. It's true.
  • (cs) in reply to jdr
    jdr:
    ... that the submitter has no idea that in the context of this API, "PI" stands for "Processing Instruction", not the Greek letter.

    ... 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

  • (cs) in reply to Theo
    Theo:
    Yeah right.

    Believe it or not, I've seen in a program a constant E which didn't have the mathematical value of e = 2.7128... And I've seen someplace else a constant B which wasn't even a boolean! WTF?!?

    PI is only two letters. What are the chances someone use it elsewhere with a different meaning to the mathematical PI? Huge.

    What are the chances that said someone (assuming that the value is declared in a library of any sort) is a blindingly stupid retard?

    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.

  • mjs (unregistered) in reply to jdr

    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?

  • _js_ (unregistered)

    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?

  • (cs)

    MAYBE IT'S PI ROUNDED OFF IN BASE 3.

  • luke (unregistered) in reply to floorpie
    floorpie:
    Mmm... pie

    Mmm... twelve pies

  • Anon (unregistered) in reply to mjs
    mjs:
    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?

    So TRWTF is that instead of using Java's enumeration feature, they declared static ints. Got it.

    The fact that Java's enum is a WTF of itself is beside the point here.

  • (cs) in reply to luke
    [image]

    (sorry, gave up trying to find a larger version)

  • Eyrieowl (unregistered)

    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.

  • (cs) in reply to belzebuth
    belzebuth:
    jdr:
    ... that the submitter has no idea that in the context of this API, "PI" stands for "Processing Instruction", not the Greek letter.

    ... 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

    When I hear the phrase "meta data," I reach for my schema 357.

    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.

  • (cs) in reply to Eyrieowl
    Eyrieowl:
    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.
    Y'know, I must have skipped more math classes than I thought.

    What exactly are the common interpretations of "XML" and "DTD"?

  • (cs)
    ...browsing the Java Swing documentation
    Everything seems to be exaggerated with Swingers!
  • Christophe (unregistered)

    I think we should hire Magnum, PI to investigate!

  • Phreakbert (unregistered) in reply to MET

    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.

  • Here you go (unregistered) in reply to han solito
    han solito:
    Must meet irish girl, I offer a reward to be payed in theDailyWTF stickers to anyone who provides me with a name and more pictures of the irish girl. (not from bustedTees, I saw everything on their website) I'm also planning to break into the BustedTees headquarters to get the info I want, otherwise I will not be able to read TheDailyWTF ever again, the feeling is worse than when applerumors.com confirmed the macbook air, or when I was a kid and they came up with a new power rangers toy every week and I couldn't afford any. Please bustedTees, I'm begging for your mercy or else.

    Good luck: http://www.collegehumor.com/article:1716262

  • BlueCollarAstronaut (unregistered) in reply to Slurper
    Slurper:
    Anomynous:
    Mmm... Irish girl

    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.

    So you must have a Magnum PI, huh?

  • BlueCollarAstronaut (unregistered) in reply to BlueCollarAstronaut

    ...oops. Christophe beat me to the pun.

  • Websense Hater (unregistered)

    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?"

  • Jay (unregistered) in reply to charonme

    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>
  • Jay (unregistered) in reply to belzebuth

    If it's the Greek letter, then the value should be 960. At least, that's what Unicode says.

  • Jay (unregistered)

    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.

  • Shawn (unregistered)

    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.

  • Anon (unregistered) in reply to Jay
    Jay:
    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.
    They've added a javax.sql.Date now too?!

    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?!

  • Jon (unregistered) in reply to OzPeter
    OzPeter:
    MFD comes out on Mon, Wed and Fri.
    Maybe it should come out on Wed, Thu and Fri instead.
  • brian (unregistered)

    The conclusion Solomon thought PI to be 3 is wrong.

    http://www.purplemath.com/modules/bibleval.htm

  • Pat (unregistered)

    Can I jump on the this-is-stupid-train too? Because this article is stupid.

  • Danny V (unregistered) in reply to han solito

    http://archives1.twoplustwo.com/showflat.php?Cat=0&Number=12873365&page=0&fpart=8&vc=1

  • aeg (unregistered)

    I think the Irish girl has to PI

  • BillyBob (unregistered)

    Dammit, they found a way to beat AdBlock... Irish girl

  • Dave B (unregistered)

    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.

  • (cs) in reply to Jay
    Jay:
    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>

    Quanta, baby, quanta.

    Mind you, they don't really help with irrational/transcendental numbers.

  • DHager (unregistered) in reply to Websense Hater

    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.

    real_aardvark:
    Eyrieowl:
    [...] Or are you all people who always spell out other abbreviations like XML, or DTD, etc...? Thought not.
    Y'know, I must have skipped more math classes than I thought. What exactly are the common interpretations of "XML" and "DTD"?
    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.
  • (cs) in reply to jdr
    jdr:
    ... that the submitter has no idea that in the context of this API, "PI" stands for "Processing Instruction", not the Greek letter.

    worst. wtf. ever.

  • (cs) in reply to DHager
    DHager:
    I'm with Websense Hater, Eyrieowl, and mjs.

    This is a lame article. The reason is is lame is because context is deliberately withheld 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.

    real_aardvark:
    Eyrieowl:
    [...] Or are you all people who always spell out other abbreviations like XML, or DTD, etc...? Thought not.
    Y'know, I must have skipped more math classes than I thought. What exactly are the common interpretations of "XML" and "DTD"?
    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.
    Bingo! Give this man a banana.

    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.

  • DHager (unregistered) in reply to real_aardvark
    real_aardvark:
    I can't even be bothered to check in my handy Wikipedia, but AFAIK, maths has no common terms labelled XML, DTD, or TWERP.

    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?

  • Prick (unregistered)

    TRWTF is that I'm still waiting for the MFD!!!

  • Emu (unregistered) in reply to WhiskeyJack
    WhiskeyJack:
    charonme:
    Staunch biblical mathematicians insist that it's 3
    Your "staunch" "biblical" "mathematicians" assume that the shape of the object in question was cylindrical, which contradicts 1Kings 7:26. Also, to obtain a 5% more precise value of pi, they would have to measure both the circumference and diameter at the same place, which again contradicts 1Ki 7:23.

    Actually, I just find it fascinating that even in ancient Biblical times they already knew some of this stuff.

    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.

  • Anon (unregistered) in reply to real_aardvark
    real_aardvark:
    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."
    Sadly this is a moot point because it's Java.

    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.

  • (cs) in reply to real_aardvark
    real_aardvark:
    DHager:
    real_aardvark:
    Eyrieowl:
    [...] Or are you all people who always spell out other abbreviations like XML, or DTD, etc...? Thought not.
    What exactly are the common interpretations of "XML" and "DTD"?
    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.
    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.

    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.

  • yason (unregistered) in reply to MET
    Anyway, why not use moderately self descriptive names like PROCESS_INSTRUCTION rather than the cryptic PI.

    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.

  • Shakje (unregistered) in reply to Jay
    Jay:
    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>

    Or, you could stop being a twat and just tell her the time.

Leave a comment on “My Pi Goes to Twelve”

Log In or post as a guest

Replying to comment #:

« Return to Article