looks like a job for an external
2011/12/16 i go bananas hard.off@gmail.com
actually, i'm not going to do anything more on this.
i had a look at the articles claude posted, and they went a bit far over my head.
my patch will still work for basic things like 1/4 and 7/8, but i wouldn't depend on it working for a serious application. As you first suggested, it's not so simple, and if you read claude's articles, you will see that it isn't.
it's not brain science though, so maybe someone with a bit more number understanding can tackle it.
On Sat, Dec 17, 2011 at 12:51 AM, Alexandre Torres Porres < porres@gmail.com> wrote:
i had a go at it
thanks, I kinda had to go too, but no time... :(
yeah, my patch only works for rational numbers.
you know what, I think I asked this before on this list,
deja'vu
will have a look at the article / method you posted, claude.
are you going at it too? :)
by the way, I meant something like 1.75 becomes 7/4 and not 3/4, but that is easy to adapt on your patch
thanks
cheers
2011/12/16 i go bananas hard.off@gmail.com
by the way, here is the method i used:
first, convert the decimal part to a fraction in the form of n/100000 next, find the highest common factor of n and 100000 (using the 'division method' like this: http://easycalculation.com/what-is-hcf.php )
then just divide n and 100000 by that factor.
actually, that means it's accurate to 6 decimal places, i guess. well...whatever :D