Re:My first (quite pointless) Ruby website
by ElbertF on Sunday October 24, 2010 @07:34PM
(#1827696)
There's more:
1,000,000,000: Errr, a few franchises?
1,000,000,000,000: You could probably buy all of McDonalds stock for that kind of money.
Oh and apparently you can buy a Sundae for as little as $.999999999999999949.
> Oh and apparently you can buy a Sundae for as little as $.999999999999999949.
Damn, I was sure hackers here would test the edge cases, but I thought it would hold! :) What you describe look like a weird behaviour in Ruby's string parsing to int (if I remember my code correctly), but I'll look into it.
Re:My first (quite pointless) Ruby website
by ElbertF on Monday October 25, 2010 @11:05PM
(#1832747)
I wouldn't worry about it, it's just how Ruby and most other languages handle floats. Do a search on Google for "ruby float precision".
Well, for $99,999, you can get 5447 Medium Fries, 5422 Big Macs, 5367 Sundaes, 5320 Chicken Selects (3 Pc.), 5275 Filet-O-Fishes, 5272 Quarter Pounders with cheese, 5254 Medium beverages and 5234 McNuggets (10 Pc.). And you'll even have 54ยข left!
(6:54:08 PM) Michelle: it told me this: $1,000,000? Seriously? A whole lot of food. No, I won't compute that for you. That's too much. You'd become obese and you'd die. I don't want to feel the guilt for the rest of my life. I might be a webserver, but I'm not heartless. Unlike you after eating all that and suffering a stroke. Your little human body is not made for that. It's a no.