# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# Compare To Zero

Determine how signal compares to zero

## Library

Logic and Bit Operations

## Description

The Compare To Zero block compares an input signal to zero. Specify how the input is compared to zero with the Operator parameter. The Operator parameter can have the following values:

• `==` — Determine whether the input is equal to zero.

• ~`=` — Determine whether the input is not equal to zero.

• `<` — Determine whether the input is less than zero.

• `<=` — Determine whether the input is less than or equal to zero.

• `>` — Determine whether the input is greater than zero.

• `>=` — Determine whether the input is greater than or equal to zero.

The output is `0` if the comparison is false, and `1` if it is true.

## Data Type Support

The Compare To Zero block accepts inputs of the following data types:

• Floating point

• Built-in integer

• Fixed point

• Boolean

The block output is `uint8` or `boolean`, depending on your selection for the Output data type parameter. For more information, see Data Types Supported by Simulink in the Simulink® documentation.

 Tip:   If the input data type cannot represent zero, parameter overflow occurs. To detect this overflow, go to the Diagnostics > Data Validity pane of the Configuration Parameters dialog box and set Parameters > Detect overflow to `warning` or `error`.In this case, the block compares the input signal to the ground value of the input data type. For example, if you have an input signal of type `fixdt(0,8,2^0,10)`, the input data type can represent unsigned 8-bit integers from 10 to 265 due to a bias of 10. The ground value is 10, instead of 0.

## Parameters

Operator

Specify how the input is compared to zero, as discussed in Description.

Output data type

Specify the data type of the output, `boolean` or `uint8`.

Enable zero-crossing detection

## Characteristics

 Data Types Double | Single | Boolean | Base Integer | Fixed-Point Direct Feedthrough Yes Multidimensional Signals Yes Variable-Size Signals Yes Zero-Crossing Detection Yes, if enabled Code Generation Yes