Carl West wrote: > > These are what I use when I need such things: > > -- good to 15 decimal places, after that you're on your own > > on roundUp arg > -- returns the next larger integer > return integer(arg + .49999999999999999) > end
This should be: on roundUp arg -- returns the next larger integer return integer(arg + .499999999999999) end Because: put .49999999999999999 = .5 -- 1 and that's not the intent. > on roundDown arg > -- returns the next smaller integer > return integer(arg - .49999999999999999) > end > > Using the value of .4999... instead of .5 avoids errors of 'rounding' integer inputs > to another integer > > For conventional rounding to the _nearest_ integer, use integer() > > -- > Carl West [EMAIL PROTECTED] http://eisen.home.attbi.com > > I have no superfluous leisure; my stay must be stolen out > of other affairs; but I will attend you awhile. > - Isabella, Measure for Measure, Act 3 Scene 1 > - > [To remove yourself from this list, or to change to digest mode, go to > http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL > PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping > with programming Lingo. Thanks!] -- Carl West [EMAIL PROTECTED] http://eisen.home.attbi.com I have no superfluous leisure; my stay must be stolen out of other affairs; but I will attend you awhile. - Isabella, Measure for Measure, Act 3 Scene 1 - [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]