Rounding a number to nearest 5 or 0
Michael Mantkowski
michaelj at clientrax.com
Sun May 3 01:34:24 UTC 2026
I use this method to find the amount of pennies to either add or subtract to the total cash to round it to the nearest .05.
This seems to be the way the states are setting up their laws to deal with this.
Begin reversible block
Set current list pvList
End reversible block
Set search as calculation {#18=1} ;; #18=1=Cash
Search list (From start,Select matches (OR),Deselect non-matches (AND),Do not load line)
Calculate lvRndPay as totc(pvList,pick(#LSEL,0.00,#20)) ;; Total Cash Payments
Calculate lvRndCnt as mid(lvRndPay,len(lvRndPay),1)/100 ;; Amount of Pennies
; Swedish Round
Switch lvRndCnt
Case 0.00,0.01,0.00
Calculate lvRndAmt as -lvRndCnt
Case 0.03,0.04,0.05
Calculate lvRndAmt as .05-lvRndCnt
Case 0.06,0.07
Calculate lvRndAmt as -(lvRndCnt-0.05)
Case 0.08,0.09
Calculate lvRndAmt as 0.10-lvRndCnt
Default
End Switch
*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************
-----Original Message-----
From: omnisdev-en On Behalf Of Andy Hilton via omnisdev-en
Sent: Saturday, May 2, 2026 11:07 AM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Cc: Andy Hilton <andyh at totallybrilliant.com>
Subject: Rounding a number to nearest 5 or 0
All
Having a rnd() brain fade day :)
If I want to round a number to the nearest 5 (i.e. 5 or 0) is there any easy one line way to do this ?
Must be a Kelly special surely….
Andy Hilton
Totally Brilliant Software Inc
Phone (US) : (863) 409 4870
Web : www.totallybrilliant.com
Helpdesk : https://totallybrilliantsoftware.supportsystem.com/
Email : andyh at totallybrilliant.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list