Contenido principal

embblk.lookupTableReciprocal

R2026b

Lookup table-based fixed-point reciprocal

Since R2026b

Description

y = embblk.lookupTableReciprocal(u,OutputType) returns 1./u with the output cast to the data type specified by OutputType.

[y,dbz] = embblk.lookupTableReciprocal(u,OutputType) returns the dbz flag that indicates whether the value of output y is the result of division by zero.

example

Examples

collapse all

Use the embblk.lookupTableReciprocal function to compute the reciprocal of a fi object using a lookup table approximation method. Include the optional dbz output to check whether division by zero occurs.

u = fi([0,10]);
outputType = fi([],1,32,24);
[y,dbz] = embblk.lookupTableReciprocal(u,outputType)
y = 

  128.0000    0.1000

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 32
        FractionLength: 24

dbz = 1×2 logical array
      1	0

Input Arguments

collapse all

Value to take reciprocal of, specified as a scalar, vector, matrix, or multidimensional array.

  • If u is a floating-point type, then OutputType must specify a floating-point data type.

  • If u is a fixed-point type, then OutputType must specify a fixed-point data type.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Data type of the output, specified as a fi object, numerictype object, or Simulink.NumericType object.

Example: fi([],1,16,15)

Example: numerictype(1,16,15)

Example: fixdt(1,16,15)

Output Arguments

collapse all

Reciprocal, returned with the same dimension as the input u and output type as specified by OutputType.

Whether the value of the output y is the result of a division by zero operation, returned as a Boolean scalar, vector, or matrix of the same dimension as input u. When the value of this signal is 1 (true), the corresponding output value is the result of division by zero. When the value of this signal is 0 (false), the corresponding output value is the result of division by a nonzero value.

For a description of the default divide by zero behavior, see Division by Zero Behavior.

Tips

  • The behavior of the Real Reciprocal HDL Optimized block with Approximation method set to Lookup Table is equivalent to the embblk.lookupTableReciprocal function. When the input to the function is a real number with a binary-point scaled fixed-point data type, the function and block provide bit-exact results.

Algorithms

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2026b