Sorry I meant round not round up and this did it:
$test = sprintf( "%.4f00", $test);
I.S
Michael Fowler <[EMAIL PROTECTED]> wrote:
>On Mon, Aug 20, 2001 at 12:30:07PM -0400, F.H wrote:
>> I am trying to format a number so I get it rounded up to 4 decimals then
>> padded with 2 zeros afterwards,
>> $test = "142.09879543" ;
>> $test = sprintf( "%.4f", $test);
>> The output that I am looking for is
>> 142.098800
>> This will be done via a loop through a whole set of numbers
>
>See perldoc -q 'round'. Given that you want to round a floating point value
>in a specific direction (up) and then pad the number out a certain number of
>zeroes, I don't know of a simple solution. You will likely need to write
>your own function, perhaps some combination of splitting on the decimal and
>using POSIX::ceil.
>
>Unless, of course, you didn't actually mean you want to round up, just that
>you want to round, in which case you should take Bob Showalter's advice and
>use sprintf or printf.
>
>
>Michael
>--
>Administrator www.shoebox.net
>Programmer, System Administrator www.gallanttech.com
>--
>
__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]