in reply to Percentages to Fractions
I'm replying to a bunch of people at once here...
Firstly, jmcnamara, I'm not sure exactly how that works, but it looks really neat. OOC, what does the ~~%_ do?
Just a general comment: My goal was to get something that approximates the truth, rather than represents it exactly. I would prefer 0.039 to be given as 1/25, rather than 974/24975, because I'm looking for "how many hands (roughly) out of 25 or less am I going to get what I'm looking for".
My code currently gives it as 1/23, which isn't very good at all, though! :)
I'm booted into Windows (and the downvotes flow in...) right now, so I'll tweak my code in a little bit, but I think that by narrowing the tolerance, I'd get a little closer to 1/25.
I like Roger's error/tolerance checking. It's much more elegant than what I've got. The reduction sub is pretty awesome too. I remember thinking about doing that, but I cheated by starting with the lowest denominators and numerators, and brute-forcing it, instead. That sub would be great to post to snippets though. :)
ysth, that's a sweet, sweet code. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Percentages to Fractions
by bunnyman (Hermit) on Feb 03, 2004 at 23:38 UTC | |
by ihb (Deacon) on Apr 13, 2004 at 00:30 UTC | |
|
Re: Re: Percentages to Fractions
by ysth (Canon) on Feb 04, 2004 at 00:08 UTC | |
|
Re: Re: Percentages to Fractions
by tsee (Curate) on Feb 03, 2004 at 22:11 UTC |