Topic: DMD0545

Help File Version: 2.10.0.636

CEILING - Adjust Up to Given Significance


The Round Up to Significance (CEILING) function adjusts the input number up, away from zero, to the nearest multiple of the given significance. The function requires two parameters: the first is the number to adjust, the second is the degree of significance to adjust to.

 

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:

 

 

R0 = CEILING( 3.72, 2 )

R0 = 4.0

 

Adjusts 3.72 up to nearest multiple of 2.

 

 

R0 = CEILING( 1.58, 0.1 )

R0 = 1.6

 

Adjusts 1.58 up to the nearest multiple of 0.1.

 

 

R0 = CEILING( 0.234, 0.01 )

R0 = 0.24

 

Adjusts 0.234 up to the nearest multiple of 0.01.

 

 

R0 = CEILING( -2.5, -2 )

R0 = -4.0

 

Adjusts -2.5 up to nearest multiple of -2.

 

 

R0 = CEILING( 3.72, 0 )

R0 = 0.0

 

The ceiling of any number to significance of 0 returns the "Not A Number" error.

 

 

R0 = CEILING( ( R1 + R2 ) / 2.0, 3 )

 

Assume R1 = 6.0 and R2 = 1.44

R0 = 6.0

 

Adds R1 and R2, then divides that by 2.0, then Adjusts up to the nearest multiple of 3.

 

 

 


See Also:

CEILING - Adjust Up To Significance

 

FLOOR - Adjust Down To Significance



MROUND - Round to Multiple

 


Related Topics:

MATH - Calculate Expression

 

FRAC - Fractional Portion of a Real Number

 

ROUND - Round Real to Nearest Whole Number

 

TRUNC - Truncate Real to Whole Number