Integer to Fixed-Point Cast Function

Scales the integer input to produce an output with the requested fixed-point type. This function is the equivalent of an arithmetic shift of the input with configurable overflow handling, constrained so that the least significant bit of the input becomes the least significant bit of the output.


icon

Inputs/Outputs

  • cunkn.png fixed-point type

    fixed-point type is the fixed-point data type to which you want to convert the integer data. You can configure the fixed-point data type in the Data Type page of the Properties dialog box. LabVIEW ignores any data in the constant or control that you wire to fixed-point type. You also can leave this input unwired and configure the output data type in the Output Configuration page of the Properties dialog box.

  • ci32.png integer

    integer is the data you want to scale. integer can be any integer data type.

  • iunkn.png fixed-point

    fixed-point is the input data scaled to the requested fixed-point data type.

  • If the word length of integer is greater than or less than the word length of fixed-point type, LabVIEW first converts integer to the integer word length of fixed-point type before casting integer to the requested fixed-point type. The least significant bit of integer becomes the least significant bit of fixed-point, so rounding is never necessary.

    To override the default behavior of this function, right-click the function and select Properties from the shortcut menu to display the Output Configuration page of the Properties dialog box. You can use this dialog box to configure the output settings of this function.

    Note The Integer to Fixed-Point Cast function combines elements of the Conversion functions, the Type Cast function, and the Scale by Power of 2 function. The Integer to Fixed-Point Cast function performs an operation that reinterprets the bits, like a cast, but also handles the numerical overflow and sign extension issues that commonly arise when combining integer and fixed-point algorithms.

    FPGA Module Details

    The following details apply when you use this object in an FPGA VI.

    Note The following details are subject to change with each version of the LabVIEW FPGA Module.

    The Fixed-Point functions do not support array inputs. However, you can pass array data to these functions element-by-element if you meet the following criteria:

    • You place the function inside a For Loop within a single-cycle Timed Loop
    • You enable auto-indexing on the For Loop tunnels
    • You use the function with other supported functions
    • You do not include shift registers or Feedback Nodes

    Examples

    Refer to the following example files included with LabVIEW.

    • labview\examples\Numerics\Fixed-Point Cast.vi