LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] fraction simplifier

[Webdev] fraction simplifier

Kae Verens kverens at contactjuggling.org
Fri Mar 8 11:05:20 GMT 2002


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?
> 
> Kae
> 

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 
the rest.

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).

-- 
Kae Verens
http://www.contactjuggling.org/ (webmaster)
http://www.independentmix.com/    (drone)





More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell