Topic: DMD0546 MROUND - Adjust to Given Multiple |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
The Round to Given Multiple (MROUND) function rounds the input number up, away from zero, if the remainder of dividing the number by multiple is greater than or equal to half the value of the given multiple; else it rounds down toward zero. The function requires two parameters: the first is the number to round, the second is the multiple to which you want to round.
This function always returns a Real value, so result should be placed in a Real memory location.
Both parameters must be positive, or both be negative. If the signs don't match, the result will be 0 and a Pos / Neg Mismatch math error will be generated. If the second parameter is 0 the result will be 0 and the Divide by Zero math error will be set.
Both parameters are expressions, which can be a numeric constant values, numeric memory locations, arithmetic expression or mathematical functions, or additional expressions up to a maximum of 1024 characters. Expressions can be nested, so use of parentheses is recommended to ensure proper evaluation order. Traditional math precedence rules are used to solve the math expression, so the use of parentheses to remove any ambiguity in the processing order is encouraged.
Refer to the examples below:
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
See Also:CEILING - Adjust Up To Significance
FLOOR - Adjust Down To Significance
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Related Topics:
FRAC - Fractional Portion of a Real Number
ROUND - Round Real to Nearest Whole Number
TRUNC - Truncate Real to Whole Number
|
||||||||||||||||||||||||
|