----- Original Message ----- From: "Daniel Nelson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 26, 2004 4:38 PM Subject: Re: <lingo-l> Math.ceil()...lingo style
> There was a discussion about this (or perhaps it was floor) on Direct-l > last year or the year before. Someone posted a very fast, elegant > solution using bitXor, I archieved that one, >From Robert Tweed -------------------------------------------------- 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 ---------------------------------------------------- Frank [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!]
