Sign Function

Returns the sign of number.

Note For nonzero complex numbers, this function returns a complex value with the same phase as the input and with a magnitude of 1.

Text-based programming languages typically call this function signum or sgn. The connector pane displays the default data types for this polymorphic function.


icon

Inputs/Outputs

  • cdbl.png number

    number can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on.

  • idbl.png -1, 0, 1

    –1, 0, 1 returns 1 if the input value is greater than 0, returns 0 if the input value is equal to 0, and returns –1 if the input value is less than 0.

    When number is in the form of a + bi, that is, when number is complex, the following defines -1, 0, 1:
  • 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.
    Single-Cycle Timed Loop Supported.
    Usage If you use this function with the single-precision floating-point data type, refer to the Using the Single-Precision Floating-Point Data Type and Deciding Which Data Type to Use in FPGA Designs topics for resource use, latency, and single-cycle Timed Loop support implications.
    Timing

    Inside single-cycle Timed Loop--When you use this function inside a single-cycle Timed Loop, the combinatorial logic delay is proportional to the number of bits in number.

    Outside single-cycle Timed Loop--When you use this function outside a single-cycle Timed Loop, it takes one clock cycle and uses one register.

    If you use this function with the fixed-point data type, the overflow and rounding modes might impact timing.

    Resources This function requires FPGA resources proportional to the number of bits in number. If you use this function with the fixed-point data type, the overflow and rounding modes might impact resources.

    Examples

    Refer to the following example files included with LabVIEW.

    • labview\examples\Numerics\Numeric Functions.vi