# minus

(-) subtraction operator. Sign change

### Syntax

X - Y -X

### Arguments

- X, Y
scalars, vectors, matrices, or hypermatrices of booleans, numbers, polynomials or rationals. They may also be some

`syslin`

lists.

### Description

Subtraction

For numeric operands, the subtraction has its usual meaning. If one of the operands is a scalar, then the substraction is performed with each component of the other operand.

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
`%F => 0`

and `%T => 1`

.

Whatever is the (regular) type of `X`

, then `[]-X`

,
`X-[]`

, and `-[]`

return `[]`

.

The subtraction operator may be extended to other custom data types through the overloading mechanism.

### Examples

[] - 2 1 - [] [2, 5] - 1 [2, 5] - [3 -2] %s - 2 1/%s - 2

--> [] - 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

With booleans:

--> -[%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

### See also

- plus — Numerical addition. Text concatenation (gluing)
- operators — scilab operator names
- overloading — display, functions and operators overloading capabilities
- oldEmptyBehaviour — Controls the operation+ and operation- behaviour for Scilab

### History

Version | Description |

6.0.0 | `A - []` and `[] - A` now return
`[]` instead of `A` or `-A` . |

## Comments

Add a comment:Please login to comment this page.