how about

  put integer (n+.5) - (integer(n+.5)=n+1)

?

and that's if you don't want to have an if clause, of course, which would
be much better in terms of readability...

  Rui Dantas



                                                                                       
                                    
                    Colin Holgate                                                      
                                    
                    <[EMAIL PROTECTED]>        To:     
[EMAIL PROTECTED]                                  
                    Sent by:                        cc:                                
                                    
                    [EMAIL PROTECTED]       Subject:     Re: <lingo-l> 
Rounding (unusually)                        
                    tworks.net                                                         
                                    
                                                                                       
                                    
                                                                                       
                                    
                    05-06-2002 14:03                                                   
                                    
                    Please respond to lingo-l                                          
                                    
                                                                                       
                                    
                                                                                       
                                    




>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)

It may take a moment or two to see why it works.

[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