- 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
Tough crowd.
Admin
Better yet, you go study context. In programming, it is reasonable to assume if the variable name (or comments, or specs, or requirements) call for a "random" number, they mean "a number randomly generated at the time of this execution". A constant obviously doesn't meet the criteria, even if it were generated randomly, even though it could belong to a random set, even though if you did randomly generate a number it's possible you'd get that same value on every execution.
Oh, and by the way, who claimed that 1 isn't random? I see plenty of posts takling about whether 1 is prime, but none talking about whether it's random.
Admin
Yeah... and if your compiler interprets numeric literals in base 6 or base 36, you have a point. Since it doesn't, your attempt to demonstrate math nerd cred backfires as you fail to properly distinguish notations from numbers.
In any language that code could possibly have come form, the token 215 means "the decimal number 215". Nice try.
Admin
Admin
I most certainly would not.
You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).
And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?
Admin
We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.
Admin
First off... you haven't made an argument. But that's ok, I happen to know an easy proof that doesn't involve real number density or any thing else very complicated.
0.333... = 1/3 multiply both sides by 3 and you get 0.999... = 3/3 collapse the fraction 0.999... = 1
Admin
Does 0.999... = 1?
How about
F(n) = lim(10^n - 1)/10^n, n -> oo)
Take the derivitive of num & denom.
F(n) = lim(10n/10n, n -> oo) F(n) = 1.0
QED
Admin
I think the mathematicians and the dilettants can agree on this, even though for different reasons.
Admin
Actually, I just realized that the derivitive of 10^n is not 10n. But the derivitive of the num & denom would be the same anyway and you would still get the answer 1.0.
Admin
Admin
As for it being prime, several people have pointed out that 215 is a prime number in other number bases. Perhaps this developer was working in an environment that operates under one of these other number bases. He also saves himself even more CPU cycles by foregoing any business logic that might assert the number's "prime-ness".
Yes, I do believe that given these very specific and completely absurd circumstances, it's safe to say that 215 could be a random prime number and that the code we are seeing is the work of an absolute genius.
Admin
The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.
I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?
I think he should have tested all the numbers...
...like I do. ;)
Admin
Let's go through it:
I claim that 'Unless 1 == 0, that's Java', which can be rewritten (at least in this universe) as 'Unless false, that's Java', or 'If true, that's Java', so in short: 'That's Java'.
You claim that my claim is (and I quote) "patently false"; in other words, 'that's not Java'.
However, it has been shown that it is.
...which doesn't mean it's not valid Java syntax as well.Ergo, you need to pick up a bit on Boolean algebra. Why don't you submit some of your code to Alex? I'm sure we'll all appreciate it. :)
Admin
I saw this somewhere:
Given x = .999...
Then: 10x = 9.999...
Now subtract x:
10x - x = 9.999... - .999...
Complete the subtraction:
9x = 9.000...
But the endlessly repeated 0 is redundant so:
9x = 9
Factor out the 9:
x = 1
Now, substituting the original value for x:
.999... = 1
QED
Admin
What about numbers that should be equal but aren't? Like (1 != 1)? (2 != 2)?
I think we're looking at a cross product of all numbers A vs. all numbers B, testing for inequality when they're equal, and testing for equality when they're not. Only then will I be confident that we are "running in the correct Universe".
And now my head hurts.
Admin
Well, to be fair, the person who posited that "0.999..." is the largest number that is less than 1 knows nothing about mathematics either. I don't know whether that was you or not.
The nature of real numbers is that if you give me a number "a" such that a < 1, there are always an infinite number of choices for a number "b" such that a < b < 1. That's where "real number density" comes in. There is no "largest number less than..." when dealing with real numbers.
So it was a BS premise that led to what you call a "moronic" argument.
Admin
Okay, in one version of ASP.NET there was a bug where Microsoft would generate a table (for a datagrid or something) that was missing the end table tag. I had to add myself to ensure that it got closed.
The could very well be a valid fix for something like that (not in NoScript tags however).
Admin
Arnold Vriezekolk's colleague is wrong when he states that he is in the wrong universe if 1=0. He is merely operating on the wrong ring. In ℤ/ℤ, zero is clearly equal to one.
Admin
I was not calling your argument moronic, I said the argument itself is moronic.
Admin
Maybe it is intended to be used as a parameter (like a #define) to a function e.g.:
Admin
I'm sorry, but I have no idea what point you're trying to make here.
Admin
Oh I'm well aware that they're the same number (just different representations) I just thought it would be fun to troll a thread on that rather than on if 1 is prime.
.999... == 1 usually provides more entertaining responses to read since the is 1 prime "debate" just ends with "it's not because we said it's not."
Edit: And looking at the last page or so, I greatly succeeded.
Admin
Haha, well done sir.
Admin
Admin
Fair enough, it's valid syntax in both C# and Java.
But you said it is Java.
And you clarified your argument, for those of us who are "running in the correct Universe": I've never heard of someone taking a snippet of code that exists in the context of a C# application and outright calling it "Java" (or vice versa). So this implies that either A) you know more about the actual habitat of this code snippet than we do, or B) you're making assumptions. I think the GP was arguing B.I'm not saying you're wrong, I'm just suggesting that you revise your statement to avoid these silly arguments.
Isn't that more accurate?Admin
Admin
Admin
Admin
Admin
No, it wouldn't. "Jewish" is a rather vague term: it's a religion, a culture, and a race. You can be Jewish because your parents and their parents and their parents, etc., were all Jewish. You can be Jewish because you were raised Jewish. Or you can be Jewish because you believe in the truth of the Old Testament but not the New Testament.
See also: http://en.wikipedia.org/wiki/Jewish_atheism http://en.wikipedia.org/wiki/Humanistic_Judaism http://en.wikipedia.org/wiki/Secular_Jewish_culture
P.S. I believe the term is "insensitive clod".
Admin
The 215 looks like a seed value for HashCode(ing) in Java (though it's obviously misnamed). We do something similar where we have a seed (to decrease collisions) and a different number which is prime *= applied to the hash of each significant field.
Joshua Bloch uses a similar technique in Effective Java.
Admin
Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.
Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.
QED
Admin
for the record: d/dx (10^x) = d/dx ((e^ln 10)^x) = d/dx (e^(x ln 10)) = by the chain rule: e^(x ln 10) d/dx (x ln 10) = (ln 10) (e^(x ln 10)) = (ln 10) ((e^ln 10)^x) = (ln 10) (10^x)
Admin
Admin
Admin
IsAlphaNumeric = IsAlphaOrNumeric = !IsAlpha & !IsNumeric (apparently)
Therefore !IsFunny & !IsInsightful = IsFunnyOrInsightful
Admin
Haven't read all the comments, but wanted to point at that example 1 isn't much of a WTF. A particular templating engine I work with, for example, could act on an object set (iterable) that has it's own properties. In order to iterate over the object's items while in that object's template you need a reference to the object to pass to the sub template.
I might seem silly if you don't know the context, but it makes perfect sense.
Admin
Admin
Admin
Admin
Admin
I had a coworker who defined these in a global include file:
#define ThereIsLifeInTheUniverse 1 #define EverAndEver ;;
(This was in C)
And then in code would do things like this...
if (ThereIsLifeInTheUniverse) ... whatever
or
for (EverAndEver) { // Hallelujah, Hallelujah! }
Admin
// warning: calling getSelf may make you go blind
Admin
IANAMathematician.
This puzzle was first given to me in high school circa 1987. I worked on it with my math teacher and, later on, with my brother because he got his degree in math.
The issues I've known to exist in this:
Performing a mathematical operation on an infinitely long number is undefined. You never technically reach the end multiplying by 10 because you don't know what happens at the very end of the number. The same thing can be argued for the subtraction.
As a value tends toward a limit in a graph, it's possible for the value that is being approached to have a discontinuity in the graph. So yes, it is likely that the two values are equal, but one cannot conclusively prove via graphs and limits that, indeed, the two are equal.
Admin
Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.
Admin
You get a 13/27 probability of winning if you switch doors.
Admin
Should have included that scenario in the unit tests, or used a real constant like
I hadn't seen the for ever and ever one before, that's pretty good!
Admin
Admin
Remember: it's a quirk of positional representation, nothing more and nothing less. If you write 0.999(9), or using your notation 0.9999..., you are representing number 1. That's all there is to it.