[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re:



Hi,

Get CPAN's  Math-Round*
or try this...

 ex:
	my $number = 5.43566;
        my $places = 2;

        my $factor = 10**POSIX::floor($places);
        $number *= $factor;

        my $fraction = $number -
POSIX::floor($number);

        $number++ if $fraction >= 0.5;

        print POSIX::floor($number)/$factor;


Pradeep.


--- Adityan Murthy <ad_it@xxxxxxxxxxx> wrote:
> Hi all,
> 
> How do i round a number to 2 decimal places in perl?
> 
> Thanks
> 
> Adityan
>
_________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
> 
> 
> ---------------------------------------------
> The mailing list archives are available at
> http://lists.linux-india.org/cgi-bin/wilma/LIP


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/