home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky sci.math:17811 sci.math.num-analysis:3748
- Newsgroups: sci.math,sci.math.num-analysis
- Path: sparky!uunet!mercury.hsi.com!code3!rogerh
- From: rogerh@code3 (Roger Harrison)
- Subject: Approximating decimal fractions with proper fractions
- Message-ID: <C0ICCG.1BJ@hsi.com>
- Keywords: fraction, approximation, number theory
- Sender: news@hsi.com (USENET news)
- Nntp-Posting-Host: code3.code3.com
- Organization: 3M Health Information Systems
- Distribution: na
- Date: Thu, 7 Jan 1993 23:38:39 GMT
- Lines: 24
-
- I am looking for an algorithm (preferably a computationally cheap one)
- to approximate a decimal fraction with a proper fraction for display
- purposes. The ideal algorithm would take a decimal fraction and the
- maximum number of digits in the result's denominator to determine the
- proper fraction (in numerator/denominator form) which best approximates
- the original decimal fraction.
-
- Stated more precisely:
-
- Given the decimal fraction F, ( F = x/y where x < y, y = 10^n, n >= 1 ),
- what is the proper fraction, a/b, that best approximates F if b < 10^m,
- m >= 1, m <= n.
-
- I have spent a fair amount of time perusing books on number theory, but
- these seem to deal with calculating decimal equivalents of fractions
- rather than finding best-fit fractions for decimal equivalents. I
- would greatly appreciate any help either with an algorithm itself or
- pointers toward published sources on the subject.
-
- --
- Roger G. Harrison
- 3M Health Information Systems
- rogerh@code3.com
-
-