The integer() function in Lingo happens to round UP (some languages it rounds down, or just acts as a trunc() (truncate) function. Lingo doesn't have a truncate function.


To round up, just do:

result =integer(myNumber)

To round down, you have to subtract .5:

result =integer(myNumber - .5)

So since you're going up, just use the integer() function.

- Tab


At 07:13 AM 6/17/03, Chris Aernoudt wrote:
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.

[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!]

[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!]

Reply via email to