CEILING and FLOOR functions
Posted: Fri Feb 05, 2021 3:29 pm
TM1 lacks the CEILING and FLOOR functions but I recently set about emulating them formulaically. I hope posting this here helps someone in the Distant Dark Futureā¢
Code: Select all
[ 'Ceiling' ] = N:
( INT ( [ 'Value' ] \ [ 'Significance' ] )
- IF ( [ 'Value' ] \ [ 'Significance' ] - INT ( [ 'Value' ] \ [ 'Significance' ] ) > 0
, -1
, 0
)
) * [ 'Significance' ] ;
[ 'Floor' ] = N:
INT ( [ 'Value' ] \ [ 'Significance' ] ) * [ 'Significance' ] ;