FlexFloor ( number ; precision )
Rate this function: Average rating: 3.7 (10 votes) Discuss this Custom Function
Kevin Frank, Kevin Frank & Associates
http://www.kevinfrank.com
An expanded "Floor" that accepts a precision argument
Sample Input:
FlexFloor ( 123.789 ; -3 )
FlexFloor ( 123.789 ; -2 )
FlexFloor ( 123.789 ; -1 )
FlexFloor ( 123.789 ; 0 )
FlexFloor ( 123.789 ; 1 )
FlexFloor ( 123.789 ; 2 )
FlexFloor ( 123.789 ; 3 ) |
|
Sample Output:
0
100
120
123
123.7
123.78
123.789 |
|
Description:
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.
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:There are no comments yet. Be the first to post a comment about this Custom Function! Please try to keep it brief & to the point. Anyone can post:
|
Newest Custom Functions:
| 1. |
list.intersect (listA; listB) |
| |
(Mon, May 14, 12:43pm) |
| 2. |
WeekStart ( weekOfYear ; year ) |
| |
(Sat, May 12, 8:42am) |
| 3. |
PercentToWords (FIELD) |
| |
(Thu, May 10, 3:16pm) |
| 4. |
PercentToText (FIELD) |
| |
(Thu, May 10, 2:37pm) |
| 5. |
StripReserved( text ) |
| |
(Wed, May 02, 6:05pm) |
| 6. |
ListBaseTables |
| |
(Wed, May 02, 3:48pm) |
| 7. |
ValidEmail( theEmail ) |
| |
(Wed, May 02, 7:27am) |
| 8. |
UltraDate (Text; LongDate_or_DateDigit) |
| |
(Wed, May 02, 6:07am) |
 |
|