主要内容

embblk.realReciprocalSqrt

R2026b

Compute reciprocal of square root of real input

Since R2026b

    Description

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

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

    example

    Examples

    collapse all

    Use the embblk.realReciprocalSqrt function to compute the reciprocal square root of a fi object. Specify the output data type to be a signed fixed-point data type with a 16-bit word length and 14-bit fraction length. Include the optional dbz output to check whether division by zero occurs.

    u = fi([1, 0.25, 4, 0],1,16,10);
    OutputType = numerictype(1,16,14);
    [y, dbz] = embblk.realReciprocalSqrt(u,OutputType)
    y = 
    
        1.0000   -2.0000    0.5000    1.9999
    
              DataTypeMode: Fixed-point: binary point scaling
                Signedness: Signed
                WordLength: 16
            FractionLength: 14
    
    dbz = 1×4 logical array
    0	0	0	1

    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.

    Slope-bias representation is not supported for fixed-point data types.

    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 square root, 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

    Algorithms

    collapse all

    Extended Capabilities

    expand all

    Version History

    Introduced in R2026b