I can't believe I never noticed this after all these years (unless I did 
and forgot it a long time ago - a good possibility), but Lingo has no 
trunc() function.

Integer rounds up, so integer(2.58) returns 3.  There's nothing to slice it.

The age-old workaround to get around this is to add .5 to the source 
number, and subtract one from the result, as in:

   truncX =(integer(x + .5)) - 1

So I can use that.  But what I was looking for and realized doesn't exist 
is a trunc function, such that:

   truncX =trunc(x)

would return 2 whether x was 2.001 or 2.999.

Sounds like an oversight! :)  Or does someone remember something I don't?

(Note that in some languages integer() works like a trunc(), and round() 
works like Lingo's integer().  But all we have is integer() and nothing else).

- Tab


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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