Topic: DMD0544

Help File Version: 2.10.0.636

FLOOR - Adjust Down to Given Significance


The Adjust Down to Significance (FLOOR) function adjusts the input number down, toward 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 = FLOOR( 3.72, 2 )

R0 = 2.0

 

Adjusts 3.72 down to nearest multiple of 2.

 

 

R0 = FLOOR( 1.58, 0.1 )

R0 = 1.5

 

Adjusts 1.58 down to the nearest multiple of 0.1.

 

 

R0 = FLOOR( 0.234, 0.01 )

R0 = 0.23

 

Adjusts 0.234 down to the nearest multiple of 0.01.

 

 

R0 = FLOOR( -2.5, -2 )

R0 = -2.0

 

Adjusts -2.5 down to nearest multiple of -2.

 

 

R0 = FLOOR( 3.72, 0 )

R0 = 0.0

 

The floor of any number to significance of 0 is the original number.

 

 

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

 

Assume R1 = 6.0 and R2 = 1.44

R0 = 3.0

 

Adds R1 and R2, then divides that by 2.0, then Adjusts down 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