Kae Verens wrote:
> I want to convert a decimal to a fraction - simply done... but I would
> prefer very simple fractions over absolute accuracy (3/7 instead of
> 43/100, for example).
>> Does anyone already have an algorithm that does this? Or am I going to
> have to oil my head clockwork?
For anyone that has a similar problem in future, the solution (lazy as
it was) that I came up with was to have a small database of common
irrational number fractions, and use a variant of Euclid's algorithm for
Yes, this was for a website, so it's not totally off topic
(www.sportinginvestments.com/index1.html - I only coded the functional
parts, so don't mention the frames or the strange similarity to
www.apple.com, or the lack of valid HTML).
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!