<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="rat" xml:lang="pt">
    <refnamediv>
        <refname>rat</refname>
        <refpurpose>aproximação racional de ponto-flutuante</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>[N,D]=rat(x [,tol])
            y=rat(x [,tol])
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>vetor ou matriz de reais </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>n</term>
                <listitem>
                    <para>vetor ou matriz de inteiros </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>d</term>
                <listitem>
                    <para>vetor ou matriz de inteiros </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>y</term>
                <listitem>
                    <para>vetor ou matriz de reais </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>
            <literal>[N,D] = rat(x,tol)</literal> retorna duas matrizes de
            inteiros tais que <literal>N./D</literal> é próxima a <literal>x</literal>
            no sentido de que <literal>abs(N./D - X) &lt;= tol*abs(x)</literal>. As
            aproximações racionais são geradas truncando-se expansões de frações
            contínuas. <literal>tol = 1.e-6*norm(X,1)</literal> é o padrão. <literal>y
                = rat(x,tol)
            </literal>
            retorna o quociente <literal>N./D</literal>
        </para>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
[n,d]=rat(%pi)
[n,d]=rat(%pi,1.d-12)
n/d-%pi
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>Ver Também</title>
        <simplelist type="inline">
            <member>
                <link linkend="int">int</link>
            </member>
            <member>
                <link linkend="round">round</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
