Main Content

normalizedReciprocal

Compute normalized reciprocal

Since R2020a

Description

example

[y,e] = normalizedReciprocal(u) returns y and e such that (2.^e).*y = 1./u and 0.5 < abs(y) <= 1.

  • If u = 0 and u is a fixed-point or scaled-double data type, then y = 2 – eps(y) and e = 2^(nextpow2(w)) – w + f, where w is the word length of u and f is the fraction length of u.

  • If u = 0 and u is a floating-point data type, then y = Inf and t = 1.

Examples

collapse all

This example shows how to compute the element-wise normalized reciprocal of a vector of fixed-point values.

u = fi([-pi,0.01,pi])
u = 
   -3.1416    0.0100    3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 13
[y,e] = normalizedReciprocal(u)
y = 
   -0.6367    0.7806    0.6367

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 14
e = 1x3 int32 row vector

   -1    7   -1

Input Arguments

collapse all

Input to take the normalized reciprocal of, specified as a real-valued scalar, vector, matrix, or N-dimensional array.

Data Types: single | double | fi

Output Arguments

collapse all

Normalized reciprocal that satisfies 0.5 < abs(y) <= 1 and (2.^e).*y = 1./u, returned as a scalar, vector, matrix, or N-dimensional array.

  • If the input u is a signed fixed-point or scaled-double data type with word length w, then y is a signed fixed-point or scaled-double with word length w and fraction length w – 2.

  • If the input u is an unsigned fixed-point or scaled-double data type with word length w, then y is an unsigned fixed-point or scaled-double with word length w and fraction length w – 1.

  • If the input u is a double, then y is a double.

  • If the input u is a single, the y is a single.

Exponent that satisfies 0.5 < abs(y) <= 1 and (2.^e).*y = 1./u, returned as an integer scalar, vector, matrix, or N-dimensional array.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2020a