FlexFloor ( number ; precision )
An expanded "Floor" that accepts a precision argument
Average rating: 4.4 (27 votes) Log in to vote
Kevin Frank - Show more from this author
Kevin Frank & Associates https://filemakerhacks.com |
FlexFloor ( 123.789 ; -2 )
FlexFloor ( 123.789 ; -1 )
FlexFloor ( 123.789 ; 0 )
FlexFloor ( 123.789 ; 1 )
FlexFloor ( 123.789 ; 2 )
FlexFloor ( 123.789 ; 3 )
100
120
123
123.7
123.78
123.789
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
While the Floor function by definition returns the greatest integer <= x, I found myself wishing it could accept a precision argument the way Truncate does. The FlexFloor custom function allows this to happen.
At first glance, it appears that FlexFloor's behavior is identical to Truncate's... i.e., they both apparently "always round down", but this is only true for positive numbers. Truncating a *negative* number will make it *larger* (i.e., bring it back toward zero), but FlexFlooring it (or simply Flooring it) will make it *smaller* (i.e., move it farther away from zero).
E.g., Truncate ( -4.7 ; 0 ) = -4 whereas FlexFloor ( -4.7 ; 0 ) = -5
Note: see also the companion custom function, FlexCeiling.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.