Re: Round UP to nearest 100
This WebDNA talk-list message is from 2007
It keeps the original formatting.
numero = 69571
interpreted = N
texte = Heh Stuart, here is some code that works. If you need rounding up the thenearest hundred when you have large numnbers, you'll need to adjust thedefault case below to check if temp = 10 in which case you'll need to adjustaccordingly (maybe slap an if statement before the return).Laters, Olin===[function name=round100][math]chars=[countchars][num][/countchars][/math][switch value=[chars]][case value=1]- for single digit numbers, always return 100[return]100[/return][/case][case value=2]- for double digit numbers, always return 100[return]100[/return][/case][case value=3]- for triple digit numbers, figure out the nexthiger[math]temp=ceil([getCharsstart=1&end=1][num][/getChars].[getCharsstart=2&end=2][num][/getChars])[/math][return][temp]00[/return][/case][default]- for all cases of 4+ digits[math]temp=ceil([getCharsstart=3&end=3&from=end][num][/getChars].[getCharsstart=2&end=2&from=end][num][/getChars])[/math][return][getCharsstart=1&end=[math]chars-3[/math]][num][/getChars][temp]00[/return][/default][/switch][return][/return][/function]1 = [round100 num=1]
99 = [round100 num=99]
344 = [round100 num=344]
944 = [round100 num=944]
1344 = [round100 num=1344]
15557884 = [round100 num=15557884]
9xx will produce a wrong number15557984 = [round100 num=15557984]
-----Original Message-----From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com] On Behalf OfStuart TremainSent: Friday, December 07, 2007 5:13 PMTo: WebDNA TalkSubject: Round UP to nearest 100How can I round up to nearest 100?RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.au-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail toWeb Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Heh Stuart, here is some code that works. If you need rounding up the thenearest hundred when you have large numnbers, you'll need to adjust thedefault case below to check if temp = 10 in which case you'll need to adjustaccordingly (maybe slap an if statement before the return).Laters, Olin===[function name=round100][math]chars=[countchars][num][/countchars][/math][switch value=[chars]][case value=1]- for single digit numbers, always return 100[return]100[/return][/case][case value=2]- for double digit numbers, always return 100[return]100[/return][/case][case value=3]- for triple digit numbers, figure out the nexthiger[math]temp=ceil([getCharsstart=1&end=1][num][/getChars].[getCharsstart=2&end=2][num][/getChars])[/math][return][temp]00[/return][/case][default]- for all cases of 4+ digits[math]temp=ceil([getCharsstart=3&end=3&from=end][num][/getChars].[getCharsstart=2&end=2&from=end][num][/getChars])[/math][return][getCharsstart=1&end=[math]chars-3[/math]][num][/getChars][temp]00[/return][/default][/switch][return][/return][/function]1 = [round100 num=1]
99 = [round100 num=99]
344 = [round100 num=344]
944 = [round100 num=944]
1344 = [round100 num=1344]
15557884 = [round100 num=15557884]
9xx will produce a wrong number15557984 = [round100 num=15557984]
-----Original Message-----From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com] On Behalf OfStuart TremainSent: Friday, December 07, 2007 5:13 PMTo: WebDNA TalkSubject: Round UP to nearest 100How can I round up to nearest 100?RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.au-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail toWeb Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
"Olin Lagon"
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Emailer setup (1997)
Emailer (WebCat2) (1997)
formatting dates from a field ... (1997)
SSL and WebCatalog (1997)
Search inside Include (1998)
WCS Newbie question (1997)
Help with Shipping Costs (1997)
Shopping Cart variation... (1997)
[writefile] (1997)
Emailer setup (1997)
How to Display text in empty fields (1997)
Configuring E-mail (1997)
Modulo function? (2000)
File Upload, Browser Timeout (2003)
Special search (1998)
Date Formats (1997)
WCS Newbie question (1997)
Multiple Users.db Possible? (1997)
changing creator codes (2000)
Frames (1997)