CONTINUED_FRACTION INDEX

CONTINUED_FRACTION _ _ _ _ _ _ _ _ _ _ _ _ operator

syntax:

continued_fraction(<num>) or continued_fraction( <num>,<size>)

This operator approximates the real number <num> ( rational number, rounded number) into a continued fraction. The result is a list of two elements: the first one is the rational value of the approximation, the second one is the list of terms of the continued fraction which represents the same value according to the definition t0 +1/(t1 + 1/(t2 + ...)). Precision: the second optional parameter <size> is an upper bound for the absolute value of the result denominator. If omitted, the approximation is performed up to the current system precision.

examples:


continued_fraction pi;
 

   1146408
  {-------,{3,7,15,1,292,1,1,1,2,1}} 
   364913


continued_fraction(pi,100);
 

   22
  {--,{3,7}} 
   7