> Hi, > > Silly question; i need to round a number to the next integer... I'd use > ceil(), but since lingo seems to lack actual rounding functions... > > How do you generally do this??? I thought of checking the first decimal > for > 0, adding 1 if so, setting the floatprecision to 0, converting to > a string and back to a number, but that seems really messy for something > this stupid... > > Thanks, > > Chris.
>From Robert Tweed, NOT my work ( much thanks BTW ) : -------------------------------------------------- on floor( x ) intX = bitOr( x, 0 ) if( x = intX ) then return intX else if( x > 0 ) then return intX else return intX - 1 end on ceil( x ) intX = bitOr( x, 0 ) if( x = intX ) then return intX else if( x > 0 ) then return intX + 1 else return intX end on roundUp( x ) intX = bitOr( x, 0 ) if( x = intX ) then return intX else if( x > 0 ) then return intX + 1 else return intX - 1 end on truncate( x ) return bitOr( x, 0 ) end ---------------------------------------------------- HTH Chris. [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!]