<?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="pt">
    <refnamediv>
        <refname>minus</refname>
        <refpurpose>(-) operador de subtração, mudança de sinal</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>X-Y
            -Y
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>X</term>
                <listitem>
                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
                        polinômios. Também pode ser uma lista
                        <literal>syslin</literal>
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>Y</term>
                <listitem>
                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
                        polinômios. Também pode ser uma lista <literal>syslin</literal>
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>Subtração</para>
        <para>Para operandos numéricos, é a operação de subtração em seu sentido
            usual. Se um dos operandos é uma matriz e o outro um escalar, a operção é
            realizada elemento a elemento.
        </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>
            Qualquer que seja o tipo (regular) de <varname>X</varname>, então <literal>[]-X</literal>,
            <literal>X-[]</literal> e <literal>-[]</literal> produzem <literal>[]</literal>.
        </para>
        <para>
            O operador de subtração pode ser estendido para outros tipos de dados personalizados
            através do mecanismo <link linkend="overloading">overloading</link>.
        </para>
    </refsection>
    <refsection>
        <title>Exemplos</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>Com booleanos :</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>Ver Também</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>Histórico</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>
