Topic: DMD0119 MATH Divide Operator |
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
The Math Divide operator ( / ) will calculate the quotient of a numerator and a denominator.
The numerator and denominator can be any mix of signed integers, unsigned integers, real (floating point) numbers or discrete values. They can be any numeric or discrete memory location or any numeric or discrete structure member. Attempting to perform a division calculation when the denominator is 0 will generate a quotient of 0 and a "Divide by Zero - $DivideByZero (ST141)" error.
Traditional math precedence rules are used to solve the math expression, The use of parentheses to remove any ambiguity in the processing order is encouraged.
All discrete and 16-bit integer values are promoted to 32-bit 2's complement signed integer values. If a Real value is included in the equation then all of the values will be promoted to Real values and all calculations will be performed using Real numbers. The most common mistake occurs when dividing two integer values but the desired result is a fractional real result. Use the TOREAL() math function to promote an integer value or integer expression to its Real equivalent
Traditional math precedence rules are used to solve the math expression. The use of parentheses to remove any ambiguity in the processing order is encouraged.
Refer to the examples below for caveats when using numbers of different types:
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
See Also:Divide
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Related Topics:
|
||||||||||||||||||||||||||||||
|