Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Unary Minus

Negate input

Library

Math Operations

Description

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 (-1 for inherited)

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. For more information, see Specify Sample Time in the Simulink documentation.

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.

Characteristics

Direct Feedthrough

No

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes, of input or initial conditions

Dimensionalized

Yes

Multidimensionalized

Yes

Zero-Crossing Detection

No

Was this topic helpful?