Function: Mod
- Updated2023-02-21
- 2 minute(s) read
Function: Mod
Divides two numeric values as integers and returns the remainder. DIAdem only uses the DIAdem function Mod if you use the FormulaCalc command in your script, otherwise DIAdem uses the VBS function Mod, which rounds the input parameters to integers, divides the numbers,and returns the divider rest.
ReturnValue = Dividend Mod Divisor
Input Parameters
| Dividend | Specifies a numeric value, a variable, or a data channel for the dividend. |
| Divisor | Specifies a numeric value, a variable, or a data channel for the divisor. |
Return Parameters
Returns the remainder as a numeric value.
Examples
The following example divides the values in each line of the Group1/Input and Group1/Reference data channels, and saves the remainders in the Group2/Result data channel:
| VBScript | Python |
Call FormulaCalc ("Ch('Group2/Result'):= Ch('Group1/Input') Mod Ch('Group1/Reference')")
The following example shows the differences between the DIAdem Mod function and the VBS Mod function:
| VBScript | Python |
Call FormulaCalc ("R1 := (e)Mod(Pi)") '=> R1 = 2.71828182845905 Call Calculate ("R1 = (e)Mod(Pi)") '=> R1 = 0
| Note You must use the commands Calculate or FormulaCalc in scripts in order 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 first physical input quantity is arbitrary. The second input quantity must be dimensionless. The first physical input quantity and the result quantity are the same. 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: Rad | Function: Random | Function: Rnd | Function: Round | Function: RTP (Real To Part of Date) | Function: RTT (Real to Text) | Function: Sign | Function: SND | Function: Sqr | Function: Sqrt | Function: Trunc | Function: VU
