<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 * Copyright (C) 2018 - Samuel GOUGEON
 *
 * 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="minus" xml:lang="ja">
    <refnamediv>
        <refname>minus</refname>
        <refpurpose>(-) 減算演算子, 符号変更</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>呼び出し手順</title>
        <synopsis>
            X - Y
            -Y
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>引数</title>
        <variablelist>
            <varlistentry>
                <term>X, Y</term>
                <listitem>
                    <para>
                        数値,多項式または有理数のスカラーまたはベクトルまたは行列.
                        <literal>syslin</literal>リストを指定することも可能です.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>説明</title>
        <para>減算</para>
        <para>
            数値オペランドの場合,一般的な意味と同じく減算を意味します.
            オペランドの一つが行列でもう一つがスカラーの場合,
            演算子は要素毎に適用されます.
            <literal>Y==[]</literal>の場合, <literal>X</literal>が返され,
            <literal>X==[]</literal>の場合, <literal>-Y</literal>が返されます.
        </para>
        <para>
            As soon as a boolean is involved in a substraction with a number (decimal, complex,
            or encoded integer), it is automatically converted in the type (and integer type)
            of the number before performing the substraction or the sign change, as
            <literal>%F => 0</literal> and <literal>%T => 1</literal>.
        </para>
        <para>
            Whatever is the (regular) type of <varname>X</varname>, then <literal>[]-X</literal>,
            <literal>X-[]</literal>, and <literal>-[]</literal> return <literal>[]</literal>.
        </para>
        <para>
            減算は,"ソフトコードされた"演算により他のデータ型についても
            定義できます
            (<link linkend="overloading">オーバーローディング</link>参照).
        </para>
    </refsection>
    <refsection>
        <title>例</title>
        <programlisting role="example"><![CDATA[
[] - 2
1 - []
[2, 5] - 1
[2, 5] - [3 -2]

%s - 2
1/%s - 2
]]></programlisting>
    <screen><![CDATA[
--> [] - 2
 ans  =
    []

--> 1 - []
 ans  =
    []

--> [2, 5] - 1
 ans  =
   1.   4.

--> [2, 5] - [3 -2]
 ans  =
  -1.   7.

--> %s - 2
 ans  =
  -2 +s

--> 1/%s - 2
 ans  =
   1 - 2s
   -------
     s
]]></screen>
    <para>With booleans:</para>
        <programlisting role="example"><![CDATA[
-[%f %t]
[%f %f %t %t]  - [%f %t %f %t]
%t - %i
c = %t - int8(7), inttype(c)
 ]]></programlisting>
    <screen><![CDATA[
--> -[%f %t]
 ans  =
   0.  -1.

--> [%f %f %t %t]  - [%f %t %f %t]
 ans  =
   0.  -1.   1.   0.

--> %t - %i
 ans  =
   1. - i

--> c = %t - int8(7), typeof(c)
 c  =
 -6

 ans  =
 int8
]]></screen>
    </refsection>
    <refsection role="see also">
        <title>参照</title>
        <simplelist type="inline">
            <member>
                <link linkend="plus">plus</link>
            </member>
            <member>
                <link linkend="symbols">operators</link>
            </member>
            <member>
                <link linkend="overloading">overloading</link>
            </member>
            <member>
                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
            </member>
            <member>
                <link linkend="mtlb_s">mtlb_s</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>履歴</title>
        <revhistory>
            <revision>
                <revnumber>6.0.0</revnumber>
                <revremark>
                    <literal>A - []</literal> and <literal>[] - A</literal> now return
                    <literal>[]</literal> instead of <literal>A</literal> or <literal>-A</literal>.
                </revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>
