"Brett W. McCoy" wrote:
> 
> On Thu, 9 Aug 2001, Ken Brakey wrote:
> 
> > Try int(number+.5), it will round up anything more than
> > '.5' to the next integer --OR-- truncate less than '.5'
> > Learned that twenty years ago, in BASIC. :-)
> 
> That's BASIC, this is Perl.  Perl's int truncates towards 0 (as the FAQ
> mentioned), so adding .5 isn't going to do anything.
> 
> $ perl -e '$num = 12.3; print int($num + .5);'
> 12

Try it with "12.6" :-)
Ken

> 
> -- Brett
>                                    http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> I'd rather have a free bottle in front of me than a prefrontal lobotomy.
>                 -- Fred Allen
> 
> [Also attributed to S. Clay Wilson.  Ed.]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to