Unary Minus

Negate input


Math Operations


The Unary Minus block negates the input.

For signed-integer data types, the unary minus of the most negative value is not representable by the data type. In this case, the Saturate on integer overflow check box controls the behavior of the block:

If you...The block...And...
Select this check boxSaturates to the most positive value of the integer data type
  • For 8-bit signed integers, -128 maps to 127.

  • For 16-bit signed integers, -32768 maps to 32767.

  • For 32-bit signed integers, -2147483648 maps to 2147483647.

Do not select this check boxWraps to the most negative value of the integer data type
  • For 8-bit signed integers, -128 remains -128.

  • For 16-bit signed integers, -32768 remains -32768.

  • For 32-bit signed integers, -2147483648 remains -2147483648.

Data Type Support

The Unary Minus block accepts and outputs signals of the following data types:

  • Floating point

  • Signed integer

  • Fixed point

For more information, see Data Types Supported by Simulink in the Simulink® documentation.

Parameters and Dialog Box

Sample time
Saturate on integer overflow

Select to have integer overflows saturate. Otherwise, overflows wrap.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.


Data Types

Double | Single | Base Integer | Fixed-Point

Sample Time

Inherited from driving block

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Code Generation


Introduced before R2006a

Was this topic helpful?