- 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
I believe that's public static final int PI 42 Then we'd all be enlightened
Admin
... that the submitter has no idea that in the context of this API, "PI" stands for "Processing Instruction", not the Greek letter.
Admin
Sorry, what was the question?
Admin
Actually, the page you linked to says that Indiana legislators didn't declare the value of pi to be anything unusual — one of them tried to do so and failed.
And "PI" doesn't always mean the ratio of a circle's circumference to its diameter.
Admin
Wasn't it Sun that invented the 'use fully qualified' names convention? PI seems to be rather unclear in that sense.
Admin
I never posted anything like this, not even did I say any bad words about MFD but... This is the worst thing ever on the first page. On sidebar it would be flamed for sure and recieve a bad vote.
Admin
Well, it cleared the Committee on Education, and was passed by the House 67-0, so you have to admit that some legislators (notice he did not say "legislature") did in fact declare pi to be an inaccurate value. It simply didn't get far enough to become law.
Admin
The PI in the screenshot is javax.swing.text.html.parser.DTDConstants.PI and therefore nothing to do with mathematical PI whatsoever. The title at the top of the table (not shown in the screenshot) makes this clear. Even without that, the fact that it's an int should be a clue!
The mathematical constant PI is found at java.lang.Math.PI and is a double with the value 3.141592653589793
So not a WTF at all.
Admin
is that this is todays wtf http://www.docjar.com/docs/api/javax/swing/text/html/parser/DTDConstants.html#PI surely someone has something better to submit than this
Admin
MFD comes out on Mon, Wed and Fri. MFD sucks big time. This WTF sucks big time.
Thus it must be Mon Wed or Fri.
So which day of the week is it??
And how come no one has submitted a MFD comment that was printed out, put on a wooden table and photographed???
Admin
Were no strangers to love You know the rules and so do i A full commitments what Im thinking of You wouldnt get this from any other guy
I just wanna tell you how Im feeling Gotta make you understand
Admin
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.
Admin
Actually, Pi has some weird properties.
/knows Pi to 50 decimal places...somehow
Admin
Admin
I'm not familiar with java, but is it at all possible for someone to use javax.swing.text.html.parser.DTDConstants.PI when they were really trying to use java.lang.Math.PI? You know some has tried, and probably found a workaround to make it run.
The WTF is that they are referring to something as PI that isn't 3.1415...
Admin
OK, I'll one up this.
I wrote some code where the number Pi is represented by integer value 262144 (2^18 for those who don't do logarithms in their head). The code handles fractions of Pi in fixed point arithmetic, so this works much better than actual Pi. The constant is internal to a single module, though.
Admin
Seriously, rick rolling still?
Admin
The biggest issue would be if you tried
and in the same class (see my previous comment for thoughts on input anything.*!)p.s. haven't actually written any Java since I left uni so the syntax for static imports might be wrong!
Admin
The real WTF is that REQUIRED has a value of 2. If anything, it should have a value of 1 (as compared to 0, not required). Clearly the wrong function was circled here. And yet, there's that title and commentary...
Admin
Actually, that case is okay. It's ambiguous, so Java will make you be specific. The case where it's bad is if you try to statically import DTDConstants., but thought you had statically imported Math.
Admin
scrape scrape, scrape scrape; "there must be something left in this barrel!!"
Admin
I bet the Irish girl knows ALL the digits to Pi...
Admin
Irish girl can "PI" me any day!
Admin
Public Const π = 3.14159265358979
Admin
Admin
Mmm... pie
Admin
Admin
Damn! You beat me to it. BTW, if Irish girl wants to beat...oh nevermind.
Admin
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.
Admin
Actually, what happened was that a nutcase wrote a math book which claimed Pi was 3, and got his legislator to propose requiring its use.
Admin
not a wtf at all by nice try
Admin
Irish Girl...oh dammit you pervs beat me to it...
It'll be a said day when St. Patrick's day is over.
Admin
*sad
Admin
Isn't it a day early to be discussing Pi anyway. Seeing as tomorrow is Pi Day (3/14).
Admin
Admin
Math.PI makes it so you'll never accidentally get the constant other than the one you want AND so your code is easier to read. It's only if there's two classes named Math with PI constants do you get into trouble...
Admin
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.
Admin
I get those confused all the time.
Admin
Generally, Java developers would do this:
TRWTF is the import package.class.* "feature".Admin
Admin
I, and everyone outside the US, make it 14/3, which must be IMAP day.
Happy IMAP day for tomorrow, everyone!
Admin
Admin
Admin
...is Irish and thinks you're all mad
Admin
Who reads the documentation anyway?
Admin
Actually, I just find it fascinating that even in ancient Biblical times they already knew some of this stuff.
Admin
This WTF sucks.
So does this mean we can never use the letters "PI" to mean anything else? And if you're really looking for an int value for PI, then you are actually the WTF.
... or should I say, those big stupidheads at Sun ALSO made PI an integer!!! hahaha!!!! ZLOL dummies!!!!
Admin
Mmm... Irish girl
Admin
The proposed law in question did not declare the value of pi to be any identifiable value.
It specified a method for calculating the area of a circle which yields a result which, if one calculated the area by "pi" * r^2, would require "pi" to be one value.
It makes several assertions about the relationship of the lengths of arcs in a circle and the dimensions of an inscribed square in the same circle, which, if calculated by conventional means, would require pi and the square root of two to be several different values.
It does not include any recognition that any of the formulas we use these days (pir^2, pid, etc) as being accurate, nor does it at any point mention "pi" by name.
Claiming that it assigns a value, inaccurate or otherwise, to pi... is giving its author far too much credit.
Admin
They didn't. Check out the quotes and you'll see that they mention things being so many cubits across or so many cubits round, but nothing about the ratio of these two measurements being a constant.