1 <?xml version="1.0" encoding="UTF-8"?>
4 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2008 - INRIA
7 * Copyright (C) 2012 - 2016 - Scilab Enterprises
9 * This file is hereby licensed under the terms of the GNU GPL v2.0,
10 * pursuant to article 5.3.4 of the CeCILL v.2.1.
11 * This file was originally licensed under the terms of the CeCILL v2.1,
12 * and continues to be available under such terms.
13 * For more information, see the COPYING file which you should have received
14 * along with this program.
18 <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="ja">
22 <refname>rat</refname>
24 <refpurpose>浮動小数点数の有理数近似</refpurpose>
32 <synopsis>[N,D]=rat(X [,tol])
52 <para>実数のベクトルまたは行列</para>
64 <para>正の実数スカラー, 許容誤差 (下記参照). デフォルト値は1d-6.</para>
76 <para>整数のベクトルまたは行列</para>
88 <para>整数のベクトルまたは行列</para>
100 <para>実数のベクトルまたは行列</para>
116 <literal>[N,D] = rat(X,tol)</literal> は,
118 <literal>abs(N./D - X) <= tol*norm(X,1)*abs(X)</literal>の基準で
120 <literal>N./D</literal>が<literal>X</literal>に近くなるような
128 <literal>y=rat(x,tol)</literal> は商
130 <literal>N./D</literal>を返します.
136 有理数近似は分数展開を丸めることにより生成されます.
146 <programlisting role="example"><![CDATA[
147 [n,d]=rat([3.5, 1.333333,-0.8])
149 [n,d]=rat(%pi,1.d-12)
155 <refsection role="see also">
159 <simplelist type="inline">
163 <link linkend="int">int</link>
169 <link linkend="round">round</link>