"Rounding up" is another name for "ceiling".  The formula is:

        (INT((X - 1) / N) + 1) * N

Where X is your original number and N is the divisor you are trying to round
to.  For example, if X is 1 and N is 1000, INT(0/1000) is 0, and you end up
with (0 + 1) * 1000, or 1000.  This will work all the way up to 1000, which
gives you INT(999/1000), still 0, so (0 + 1) * 1000 = 1000.  At 1001,
however, you get INT(1000/1000) or 1, so you get (1 + 1) * 1000 = 2000.

Step functions rule.

Joe


From: Alan Shore

Greg - this rounding algorithm is for rounding to the nearest whatever.
NOT rounding UP to the nearest whatever.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.