Something with word size of multiplying by 1000, I'd venture. 
This works as you need, I think:

$credit = "64.63";
$amount = $credit * 100;
printf "credit %s,  amount %12.12d\n", $credit, $amount;

$amount = $amount * 10;
printf "credit %s,  amount %12.12d\n", $credit, $amount;

$amount = $amount / 10;
printf "credit %s,  amount %12.12d\n", $credit, $amount;


but that begs the question, "Why are you doing ( x * 1000 / 10 ) 
and not just ( x * 100 ) to start with?

John


-----Original Message-----
From: Howard, Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 28, 2006 7:29 PM
To: Dr.Ruud; beginners@perl.org
Subject: RE: number rounding problem


But the file output format I'm required to produce is 12 positions with
leading zeros and no decimal.

:-(

Chris



-----Original Message-----
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Monday, August 28, 2006 11:17 AM
To: beginners@perl.org
Subject: Re: number rounding problem


"Howard, Chris" schreef:

> What starts out as 64.63  ends up being 00000006462

No, it ends up beint printed as that. Replace your %12.12d by one of
(%s, %f, %g) to get different representations.

See also

   perldoc -q decimals

--
Affijn, Ruud

"Gewoon is een tijger."



--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/>
<http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to