Hows this? :-)

n = 4.1

z = (n - integer(n - 0.5))

put n - (n - integer(n-.5)) + (z > 0)
-- 5.0000

Works like a charm, Colin. Just for the heck of it I went through it all.
Took a while to make out though. I removed the multiplication with the
boolean result at the end. I think it's redundant.

Regards,
Pranav Negandhi




>put integer(1.9 + 0.5)
>-- 2
>
>Regards,
>Pranav Negandhi


Unfortunately that would not work out:

put integer(1.0 + 0.5)
-- 2

The goal was to let 1.0 be 1.

Here's something that does work, but I feel sure there's something
simpler (it can be simpler in two lines, but just for the fun of it
I'm trying one line):

put n - (n - integer(n-.5)) + 1 * ((n - integer(n-.5))>0)

<snip>



[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