Main Content

eq, ==

Determine whether real-world values are equal

Description

example

A == B returns a logical array with elements set to logical 1 (true) where the real-world values of arrays A and B are equal, when A or B is a fi object. Otherwise, the element is logical 0 (false). The test compares both real and imaginary parts of numeric arrays.

In relational operations comparing a floating-point value to a fixed-point value, the floating-point value is cast to a fixed-point type that preserves the relative order of the value with respect to the value in the fixed-point fi object.

example

eq(A,B) is an alternate way to execute A == B, but is rarely used.

Examples

collapse all

Use the eq function to determine if two fi objects have the same real-world value.

a = fi(pi);
b = fi(pi,1,32);
a == b
ans = logical
   0

Input a has a 16-bit word length, while input b has a 32-bit word length. The eq function returns 0 because the two fi objects do not have the same real-world value.

When comparing a double to a fi object, the floating-point double is cast to a type that preserves the relative order of the value with respect to the value in the fixed-point fi object. This behavior allows relational operations to work between fi objects and floating-point constants without introducing floating-point values in generated code.

a = fi(pi);
b = pi;
eq(a,b)
ans =

  logical

   0

Input Arguments

collapse all

Operands, specified as scalars, vectors, matrices, or multidimensional arrays. Inputs A and B must either be the same size or have sizes that are compatible. For more information, see Compatible Array Sizes for Basic Operations.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes

Extended Capabilities

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a

expand all

See Also

| | | | |