Main Content

fixed.cordicDivide

Fixed-point divide using CORDIC

Since R2020b

Description

y = fixed.cordicDivide(num,den,OutputType) divides num by den using the output data type specified by OutputType.

example

Examples

collapse all

num = fi(1);
den = fi(10);
OutputType = fi([],1,16,15);
y = fixed.cordicDivide(num,den,OutputType)
y = 

    0.1000

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

Input Arguments

collapse all

Numerator, specified as a real-valued scalar, vector, matrix, or multidimensional array.

  • 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.

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

Numerator, specified as a real-valued scalar, vector, matrix, or multidimensional array.

  • 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.

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 inputs num and den, fixed.cordicDivide 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.cordicDivide follows IEEE® Standard 754.

Extended Capabilities

Version History

Introduced in R2020b