Main Content

fixed.cordicReciprocal

Fixed-point reciprocal using CORDIC

Since R2021b

Description

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

example

Examples

collapse all

u = fi(10);
outputType = fi([],1,32,24);
y = fixed.cordicReciprocal(u,outputType)
y = 

    0.1000

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

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 built-in integer type, then OutputType must specify a built-in integer 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
Complex Number Support: Yes

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

  • If num is a floating-point type, den must also be a floating-point type and OutputType must specify a floating-point data type.

  • If num is a built-in integer type, den must also be a built-in integer type and OutputType must specify a built-in integer data type.

  • If num is a fixed-point type, den must also be a fixed-point type and OutputType must specify a fixed-point data type.

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

Example: numerictype(1,16,15)

Example: fixdt(1,16,15)

More About

collapse all

CORDIC

CORDIC is an acronym for COordinate Rotation DIgital Computer. The Givens rotation-based CORDIC algorithm is one of the most hardware-efficient algorithms available because it requires only iterative shift-add operations (see References). The CORDIC algorithm eliminates the need for explicit multipliers. Using CORDIC, you can calculate various functions such as sine, cosine, arc sine, arc cosine, arc tangent, and vector magnitude. You can also use this algorithm for divide, square root, hyperbolic, and logarithmic functions.

Increasing the number of CORDIC iterations can produce more accurate results, but doing so increases the expense of the computation and adds latency.

Algorithms

For fixed-point input u, fixed.cordicReciprocal wraps on overflow for division by zero. The behavior for fixed-point division by zero is summarized in the table below.

Wrap OverflowSaturate Overflow
0/0 = 00/0 = 0
1/0 = 01/0 = upper bound
-1/0 = 0-1/0 = lower bound

For floating-point inputs, fixed.cordicReciprocal follows IEEE® Standard 754.

Extended Capabilities

Version History

Introduced in R2021b