Re: roundUp500

2011-03-03 Thread Bob Sneidar
You trigonometry wiz kids just amaze me. ;-P Bob On Mar 3, 2011, at 11:57 AM, Alex Tweedly wrote: > > put 500 * round(x/500 + 0.499) > > -- Alex. > > > On 03/03/2011 17:06, FlexibleLearning wrote: >> Here's a poser for you all... >> >> How to round a number UP to the nearest 500? >> >

Re: roundUp500

2011-03-03 Thread Alex Tweedly
put 500 * round(x/500 + 0.499) -- Alex. On 03/03/2011 17:06, FlexibleLearning wrote: Here's a poser for you all... How to round a number UP to the nearest 500? Hugh Senior FLCo ___ use-livecode mailing list use-livecode@lists.runrev.com Plea

RE: roundUp500

2011-03-03 Thread FlexibleLearning
Yeah! Minor tweak and it's working: function roundUp500 theNumber return trunc((theNumber-1)/500+1)*500 end roundUp500 Many thanks Mark and Brian. I love this group. Hugh Senior FLCo On 3 mrt 2011, at 18:06, FlexibleLearning wrote: > Here's a poser for you all... > > How to round a numb

Re: roundUp500

2011-03-03 Thread Brian Yennie
Another variant: trunc(n + (500 - (n mod 500))) > Hi Hugh, > > function roundUp500 theNumber > return trunc(theNumber/500+1)*500 > end roundUp500 > > Seems to work. > > -- > Best regards, > > Mark Schonewille > > Economy-x-Talk Consulting and Software Engineering > Homepage: http://economy-x

Re: roundUp500

2011-03-03 Thread Mark Schonewille
Hi Hugh, function roundUp500 theNumber return trunc(theNumber/500+1)*500 end roundUp500 Seems to work. -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 New: Down