- 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 think it's a setting on the ATM that allows clients to withdraw only i*n dollars at a time, being i an integer and n the amount of the smallest banknote stored in the machine.
So, apparently Monty was going to withdraw 40 $ as an infinity of 0 $ dollar bills.
edit: sorry, pointed out by other poster
Admin
Eve online
Admin
Admin
Guild Wars.
DAMMIT. I did it wrong.
Admin
EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online EVE Online
Admin
Once again we must all be in awe at the ease in which TopCod3r is able to troll.
If I had a hat it would be off.
Admin
omg that's OVER 9000 !
Admin
Hey, this is Monty and while the ATM did present me an unsolvable problem it dispensed my 40 bucks with no trouble. :P
So unfortunately it's not as simple as the machine running out of money. :P
Admin
What would be really awesome is if the game gave you a stack trace when you select « 3. Could you give me some more details? »
Admin
Admin
I seriously hope you are kidding, but I am afraid you are not...
Admin
There, I divided 4 by 0.
See how easy that was?
Admin
Admin
(arithmetic) Of an integer, that, when divided by another integer, leaves no remainder.
Admin
Admin
Admin
What's wrong with: If z = 0 Then ?
Admin
Perhaps it didn't have an infinite number of $0 bills left, maybe someone had withdrawn one (or more) since it was refilled.
Admin
Did I specify I was using the arithmetic definition of the word divisible?
p.s. hint: We live under bridges...
Admin
Admin
For some banks, the ATM error message could be worse. It could simply say "Game Over".
Admin
If you accept the exception mission, does their bug tracking system assign the bug to you?
Admin
FWIW, on the ATMs I've worked on that number is stored in a XML file on the ATM itself, and can be either explicitly defined or set to lowest denomination of bills in stock.
Lowest Denomination is picked up from another area of the file, which sets which cash cartridges are loaded and with what denomination of bills. If, say, Cash Cartridge 4 was not reloaded the last time the machine was serviced, and the denomination was set to 0 instead of empty... It would need to have bills in it though, otherwise it would read empty and be disabled.
It's possible. I would hope the software would validate the bill denomination as being valid, but I certainly wouldn't bet on it. I've certainly not tried entering invalid bill denominations into ATMs, so can't be positive what happens.
Admin
Nope. If I don't want to use 0.000000000001 if Z is 0. I want to do something else (preferably handle the problem). Otherwise I'm going to sit with stack overflow exceptions.
Admin
Even worse, there's a LOLCat saying "I'm Nside ur ATMz eating ur moniez!"
Admin
Congrats! You may be Old Coder, but you're the first dummy in this thread to fall for the resident troll. What an honor!
TopCod3r: Another great post. Thanks!
Admin
Actually, forget I said that (especially the "stack"... I was just busy working with a stack overflow problem :).
Dividing by 0.000000000001 still gives me a "Divide by Zero" exception. So it's not a very good solution.
Admin
Let's see how funny you are going to find it once someone picks up TopCod3r's code and causes the next Ariane rocket crash or something similar.
Admin
Can I have your stuff?
Admin
Overall this is a good solution, but I prefer to abstract all of this in a class (and require everyone to use it for ALL math operations). We are a Java shop and I am not allowed to give away our architecture for company policy reasons, but the basic idea is:
public interface Operation { public Number do(Number n1, Number n2); };
public class OperationFactory { public static Operation create(String type) { ... if (type.equals("divide") || type.equals("division")) { return new Division(); } } }
public class Division implements Operation { public Number do(Number n1, Number n2) { try { Number result = n1.doubleValue() / n2.doubleValue(); return result; } catch (Exception e) { return new Double(0.0); } } }
So in order to divide, it's really easy: Number result = OperationFactory.create("division").divide(5.0, 0.0); if (result.equals(new Double(0.0)) { ... HANDLE THE ERROR HERE }
So you see if you forgot to check if the result is zero, your program won't crash (the result will just be zero!), which adds more robustness to the program. ALso note that if you are using Java 1.5 or above, you can take advantage of autoboxing and unboxing. However, our code needs to be compatible with Java 1.4, so we can't use this/
Admin
infinite number minus one (or more) is still infinite number.
Admin
Lets see, Peter Sellers was English, Spike Milligan was Irish and Harry Secombe was Welsh. So who is the Scottish goon that you're referring to?
Admin
Admin
Admin
Admin
http://en.wikipedia.org/wiki/The_Goon_Show
Admin
What, I thought that infinity was 16!
Admin
Jesus man, even Error'd isn't safe from your highly proficient baiting. You must get up very early in the morning.
By the way, that game is EVE Online, don't know if anyone's mentioned that yet...
Admin
Hey does anyone know what game that screenshot is from?
Admin
Page Aleph-null out of Aleph-one
Admin
This is an easy one. Infinity is not a number - it's a concept. Infinity-1 is not a valid equation and therefore does not result in a valid number. It would be akin to saying that orange-1 is less than orange - it just doesn't make sense.
Admin
The real WTF is that this is apparently a reply to #220700:
Well done - you somehow manage to beat the bloke who thinks "a is divisible by b" means that a and b are both numbers. (Insert discussion about quaternions here.)
Admin
It's the Enterprise Manager for the new MS-SQL beta.
Admin
I'm not sure if that's Eve Online or the Hello Kitty Island Adventure game, but I found this programmer's forum while doing a search on "Gardening" from Cuil. I have a newbie question. Does anyone know if the mv command is autonomic? Will it roll back if it runs out of space before completing the move?
Thx
Admin
Battletoads!
(sorry, I couldn't resist)
Admin
-Harrow?
Admin
captcha: EVE online
Admin
Orange - 1 is rag. Easy.
Admin
Admin
Regarding how to check for a potential divide-by-zero without just catching the exception: The MATLAB folks here compare the absolute values of the denominators to a really small number, and if they find something below that, they do something about it. Having Infs and NaNs in your matrices can really slow things down with large data sets. MATLAB provides a function for finding these really small numbers: eps (short for epsilon):
What you do about a potential divide-by-zero depends on the application. Sometimes you change the denominator to a minimum value; sometimes you make the denominator inf so the result is zero; sometimes you trim the data set to exclude the bad points; sometimes you throw an exception of your own.
Nobody adds a small number before dividing because this just moves the domain of "values which will cause a divide-by-zero" over to one side; if you get a denominator which, when a small value is added, approaches zero, you're back where you started.