Function: Sign
- Updated2023-02-21
- 2 minute(s) read
Function: Sign
Specifies the sign of a number.
ReturnValue = Sign(Value)
Input Parameters
| Value | Specifies a numeric value, a variable, or a data channel. |
Return Parameters
| ReturnValue | Receives the sign of number. The value is -1 for negative values, 0 for the value 0, and 1 for positive values. For invalid values the value is NoValue. |
Examples
The following example determines the sign for the value -Pi.
| VBScript | Python |
Dim lngMyResult lngMyResult = Sign(-Pi) 'lngMyResult = -1
The following example determines the signs of the values in the Group1/Input data channel and saves the result in the Group2/Result data channel.
| VBScript | Python |
Call Calculate ("Ch(""Group2/Result"")= Sign(Ch(""Group1/Input""))")
| Note You must use the Calculate command in scripts to calculate data channels with formulas. Compute the data channels according to the syntax in the Calculator. Refer to the procedures Executing Channel Calculations in the Calculator and Assigning a Value to a Variable in the Calculator for more information about the Calculator. |
![]() | The physical input quantity is arbitrary. The physical result quantity is dimensionless. The Input and Result Quantities for Quantity-Based Calculations page contains an overview of the input quantities and result quantities of all functions. Refer to the Help page Calculating Quantity-Based and Non-Quantity-Based in DIAdem for the conditions and rules for quantity-based calculations. |
Related Functions
Function: ^ | Function: Abs | Function: Ceil | Function: Deg | Function: Eex | Function: Exp | Function: Fak | Function: Floor | Function: Frac | Function: Lg | Function: Ln | Function: MaxV | Function: MinV | Function: Mod | Function: Rad | Function: Random | Function: Rnd | Function: Round | Function: RTP (Real To Part of Date) | Function: RTT (Real to Text) | Function: SND | Function: Sqr | Function: Sqrt | Function: Trunc | Function: VU
