Joel R Stout wrote:
> print " rand: $p \n";
> print "int: $q \n";
> print " ceil: $r \n";
> print " floor: $s \n";
>
> if ( $p - $s >= .5 ){
> $t = $r
> } else {
> $t = $s
> }
> print "rounded: $t\n";
Another novice's 2 [euro] cents:
$round = ($number>0)?floor($number+.5):ceil(
PROTECTED]]
Sent: Thursday, October 18, 2001 2:31 PM
To: [EMAIL PROTECTED]
Subject: Re: Fraction to integer.
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Amit Joshi) wrote:
> Is there a way in perl to directly convert a fractional number to
> its nearest integer value ??
use t
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Amit Joshi) wrote:
> Is there a way in perl to directly convert a fractional number to
> its nearest integer value ??
use the int() function.
http://www.perldoc.com/perl5.6.1/pod/func/int.html
--
brian d foy <[EMAIL PROTECTED]> - Perl ser
On Thu, Oct 18, 2001 at 08:57:40PM +, Amit Joshi wrote:
> Is there a way in perl to directly convert a fractional number to
> its nearest integer value ??
See perldoc -q round.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.c
> -Original Message-
> From: Amit Joshi [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 18, 2001 4:58 PM
> To: [EMAIL PROTECTED]
> Subject: Fraction to integer.
>
>
> Hi,
>
> Is there a way in perl to directly convert a fractional number to
> its
Hi,
Is there a way in perl to directly convert a fractional number to
its nearest integer value ??
Thanks,
Amit.
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
To unsubscribe, e-mail: [EMAIL PRO