| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:22
•
by
PZ
(unregistered)
|
|
22.0f/3 was quite a common way of representing PI in a rough way before frameworks came long and stuck 'official' PI constants in.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:29
•
by
Nagesh
(unregistered)
|
In the India we using 22/7, no 22/3. Thank you, come again! |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:33
•
by
Chronomium
(unregistered)
|
|
As far as pointless boolean synonyms go, "YOUBET" is a new one.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:34
•
by
KattMan
|
The Christian bible states that PI is 3. No floats needed back in those days I guess. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:41
•
by
Nagesh
(unregistered)
|
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:50
•
by
Jerry
(unregistered)
|
There are a lot of people out there who have no business coding for web sites. You can usually spot them by checking for anyone who is coding for web sites. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:50
•
by
Pavel
(unregistered)
|
|
I like the graveyard of bad ideas. I might steal that.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:52
•
by
C-Derb
(unregistered)
|
I'd be willing to bet that this guy (gal?) got better grades in English class than in Math class. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:54
•
by
Kef Schecter
(unregistered)
|
|
I had a math teacher in middle school who (briefly) insisted that 22/7 is an exact representation of pi.
Perhaps she should have looked up what "irrational number" means... |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:54
•
by
Ralph
(unregistered)
|
This message almost got it right. The correct advice is:
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:55
•
by
Ken B.
(unregistered)
|
Given that it's only accurate to 2 decimal places, I would think hard-coding "3.14" would be easier. Either that, or "355./113". It's only 1 character longer than "22.0f/3" and it's accurate to 6 decimal places. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 11:57
•
by
Paul
(unregistered)
|
C'mon, is this for real? I guess you gotta love a boolean that successfully implements Maybe. Gentlemen, we are within inches of developing the technology to properly handle True, False, FileNotFound. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:01
•
by
Glenn Lasher
(unregistered)
|
|
The left out 'Yowzah!' as a possible TRUE value.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:05
•
by
Steve The Cynic
|
Probably, but I worry a little about what happens if the number was already negative... What does StrToInt do with "--7"? |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:11
•
by
Shaftway
(unregistered)
|
|
I don't see a problem with the C# rounding routine. AFAIR, C# doesn't offer a "round to {x} decimal places" and has a major gotcha in the official rounding routine.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:14
•
by
Kaniu
(unregistered)
|
|
Round isn't actually that bad. It's a way to replace C#'s default rounding "half towards even" with a more conventional "half towards up".
The real WTF is why would anyone want to use banker's rounding as a default method. http://msdn.microsoft.com/en-us/library/aa340227(v=vs.71).aspx http://en.wikipedia.org/wiki/Rounding#Round_half_to_even |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:15
•
by
XXXXX
(unregistered)
|
Never has a comment on this site been more FileNotFound. You should be AdjectiveNotFound of yourself. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:16
•
by
Anonymous Genius
(unregistered)
|
|
Yeah, apart from the missing '+' it seemed fairly reasonable to me. There are valid reasons for wanting to write your own rounding routine-- for example, in many financial applications, it is desirable to add something like 0.5000000001 instead of 0.5 to keep floating point error from causing the result of some calculations to round down erroneously.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:22
•
by
PZ
(unregistered)
|
Err...I come from a universe where different physical laws apply <shuffles away quietly> |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:25
•
by
Sagan
(unregistered)
|
|
When you're working with crazy stuff like PI, close enough has got to be good enough. You're never going to get it perfect.
And I mean never as in universe freezes solid type of never. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:28
•
by
Reinier
(unregistered)
|
|
The filexists function can be explained by print statement debugging.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:28
•
by
Fred
(unregistered)
|
My Java teacher (who was an accountant, not a computer geek) said we had to do this. Encapsulation or something like that. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:31
•
by
Pastor Eyes
(unregistered)
|
Well if you're going to pay any attention to that old thing, it also says Jesus walked on water. No floats needed for that either I suppose. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:44
•
by
History Teacher
(unregistered)
|
If you're using floating point numbers in a financial application, you're doing it wrong. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:47
•
by
Nagesh
|
use only oracle floats! |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:53
•
by
Some Damn Yank
(unregistered)
|
You shouldn't use floating point for financial calculations. You always round to the nearest penny, in the [bank's|government's|company's] favor. In the case of the IRS, you round to the nearest dollar in the government's favor. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 12:56
•
by
Jonathan Hamilton
(unregistered)
|
Not until the Deluge, at least. Heyo! |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:16
•
by
pedagogical pedant
(unregistered)
|
Nor today, if you have Prof. Frink teaching you: http://www.youtube.com/watch?v=O-Y-ua3WBi4 |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:20
•
by
operagost
|
That's a load of SHEEIT. I'm certain that you never read the verses in question, but just repeated this fallacy-- so I'll ask you to read it for the first time. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:22
•
by
operagost
|
Even if we ignore the definition of the word "miracle", there are plausible circumstances in which a person could walk (or appear to walk) on water. But pi is a constant that will never be 3. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:26
•
by
ShatteredArm
|
|
{"Maybe",__TIME__[7]&1}
I see no problem with the computer making a decision for you if you're waffling. This is a solid implementation of "Maybe." |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:29
•
by
Kef Schecter
(unregistered)
|
Please tell me this is a joke. (Just in case it isn't: don't use floating point for financial crap) |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:30
•
by
Zylon
|
Thank you, Buzz Killington. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:30
•
by
KattMan
|
My Initial troll post finally wins. |
|
Maybe is Prof. Alan Turing's engine. Read computer history to get knowledge like me.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:42
•
by
Infinite Time and Space
(unregistered)
|
I disagree. Perhaps PI is not really constant throughout all time and positions in the infinite universe? Perhaps it is changing ever so slightly, so slow that in all of human history and in our galaxy, the change would be undetectable. At some point in time and space, it very well could be 3. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:43
•
by
Anketam
|
The actual smallest unit of currency in the US is 1/10 of a cent. Just look at gas prices, they love charging 9/10 of a cent per gallon of gas. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:45
•
by
Anketam
|
I think you should put that idea in your graveyard. _______________________________ To understand recursion, you must first understand recursion. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:52
•
by
wonk
(unregistered)
|
|
The code above actually has a typo. It should read "YOUBETCHA" instead of "YOUBET". It was part of the Minnesota release.
|
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:55
•
by
Canada Eh?
(unregistered)
|
I walk on water all the time. From late December to about March. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 13:59
•
by
Tristram
(unregistered)
|
|
Ooh, I know how to fix this code. Works as advertised:
// Convert to negative number varInt := StrToInt('-1'); |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:03
•
by
Born Texas Proud
(unregistered)
|
And that's one of the reasons that Texas will not implement Obamacare: we don't need the Federal Government telling us what PI is and how it should be calculated and what we are and are not allowed to do with our Mexican slaves. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:03
•
by
dogmatic
(unregistered)
|
|
With the boolean table, can a jokey Easter egg be considered a WTF? Personally I live the implementation of maybe.
The round function is just fine. And you may indeed find uses for floats in financial software, some of them may even be legal! |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:06
•
by
Heinz
(unregistered)
|
|
You can get this code to fail:
/** * Tests if {@link XXXX} class extends {@link Object} class. */ @Test public void testInheritance() { Assert.assertTrue("Class does not extends Object class.", instance instanceof Object); } Simply pass in "null". |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:25
•
by
Frank
(unregistered)
|
|
x=atan(1)*4
is perfect! |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:31
•
by
Jinren
(unregistered)
|
I like how it's apparently more reasonable to invoke changing universal constants than it is to consider that the book might just have been describing a shitty engineer. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:38
•
by
Jay
(unregistered)
|
At the risk of being mildly serious: The Bible gives the measurements of a certain object, mentioning that the diameter is 10 and the circumference is 30. (a) There is no such thing as an "exact measurement"; there is only measurement within a certain precision. This is commonly discussed in science classes under the heading "significant figures" -- feel free to google the phrase for details. As the quote is not from a scientific treatise but from a general discussion of the furniture in a certain building, the writer does not tell us the number of significant digits, but it's likely 2 or maybe only 1 (given that both numbers are multiples of ten). If you perform an arithemtic calculation on two numbers and the least accurate has only one significant digit, the answer is only meaningful to one significant digit. If the writer had said that he measured the circumference as 10 cubits accurate to 1 significant digit, and then concluded that the circumference was 31.42 cubits, he would have been marked wrong in my chemistry and physics classes. Indeed, when I took chemistry in college, we had a question on a test that said you have a beaker with 40 g of water, you add .01 g of salt, what is the weight of the resultant mixture? The correct answer was 40 g. Students who wrote 40.01 g were marked wrong, because they had failed to understand the concept of significant figures. In this case, 10 * 3.14159... = 30 -- one significant digit -- not 31.4159. You can't invent additional precision out of thin air. (b) Even ignoring that this is a physical measurement and therefore inherently an approximation, pretending it's a question in abstract geometry, please tell me what you think the "correct" answer is. If you say 31, you are no better than the original writer: pi is no more equal to 3.1 than it is to 3. If you say 31.4, that's not an exact value for pi either. You could give 100 digits and it still wouldn't be exact. No matter how many digits you give, you will not be stating the exact value for pi. The only way to exactly state the value of pi is to say "pi" or give an algorithm. I suppose the writer could have said that the circumference was "10 times pi", but that just leaves it to the reader to do the calculation himself. So you're ridiculing the Bible for, (a) failing to ignore the concept of significant figures, and (b) failing to ignore the fact that pi is a transcendental number. Apparently Moses understood science better than you do. |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:41
•
by
Willie
(unregistered)
|
|
Perhaps the last file_exists encapsulation required a strict 0/1 type instead of a true/false return. You could do it in one line with type casting, but without knowing all the requirements, it could have been perfectly valid.
|
|
Pi in the bible, come on guys. This brillant bit comes from creationists:
So yes, 30 cubits / 10 cubits = 3. And now their Jesuit escape
This comes from people who take the Bible literally. Is this bigotry the original WTF for which Jesus died at the cross? Anyway, they do show us good use of the C# rounding routine in Biblical times... |
Re: The Object Test, a New PI, and More SHEEIT
2012-07-09 14:50
•
by
pjt33
|
That's how you know it was a chemistry question. If it had been a physics question the correct answer would have been 0.4N (assuming it to be in close proximity to the surface of the Earth). |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |