Copyright (C) 2000-2012 |
GNU Info (slib.info)RationalizeRationalize ----------- `(require 'rationalize)' The procedure "rationalize" is interesting because most programming languages do not provide anything analogous to it. Thanks to Alan Bawden for contributing this algorithm. - Function: rationalize x y Computes the correct result for exact arguments (provided the implementation supports exact rational numbers of unlimited precision); and produces a reasonable answer for inexact arguments when inexact arithmetic is implemented using floating-point. `Rationalize' has limited use in implementations lacking exact (non-integer) rational numbers. The following procedures return a list of the numerator and denominator. - Function: find-ratio x y `find-ratio' returns the list of the _simplest_ numerator and denominator whose quotient differs from X by no more than Y. (find-ratio 3/97 .0001) => (3 97) (find-ratio 3/97 .001) => (1 32) - Function: find-ratio-between x y `find-ratio-between' returns the list of the _simplest_ numerator and denominator between X and Y. (find-ratio-between 2/7 3/5) => (1 2) (find-ratio-between -3/5 -2/7) => (-1 2) automatically generated by info2www version 1.2.2.9 |