File r37/lisp/csl/html/r37_0144.html artifact cdb828ca87 part of check-in 3c4d7b69af



<A NAME=CONTINUED_FRACTION>

<TITLE>CONTINUED_FRACTION</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>CONTINUED_FRACTION</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
 <P> <H3> 
syntax: </H3>
<em>continued_fraction</em>(&lt;num&gt;) 
or <em>continued_fraction</em>( &lt;num&gt;,&lt;size&gt;) 
<P>
<P>
<P>
This operator approximates the real number &lt;num&gt; 
( 
<A HREF=r37_0323.html>rational</A> number, 
<A HREF=r37_0330.html>rounded</A> 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 <em>t0 +1/(t1 + 1/(t2 + ...))</em>. 
Precision: the second optional parameter &lt;size&gt; is an upper bound 
for the absolute value of the result denominator. If omitted, the 
approximation is performed up to the current system precision. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
continued_fraction pi;
 

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


continued_fraction(pi,100);
 

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

</TT></PRE><P>

REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]