On Jul 1, Jeff 'japhy' Pinyan said:
>On Jul 1, Ned Cunningham said:
>
>>Can anyone tell me how to print the following data so that it rounds up
>>even though it shouldn't
>
>Use the POSIX::ceil() function, instead of some crufty solution.
>
> use POSIX 'ceil';
> printf WRFILE "%11.2f", ceil
On Jul 1, Ned Cunningham said:
>Can anyone tell me how to print the following data so that it rounds up
>even though it shouldn't
Use the POSIX::ceil() function, instead of some crufty solution.
use POSIX 'ceil';
printf WRFILE "%11.2f", ceil($data);
--
Jeff "japhy" Pinyan [EMAIL
You could always try adding .999 to the value before sprintf()ing it...
-Original Message-
From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 11:32 AM
To: '[EMAIL PROTECTED]'
Subject: printf question
Hi,
Can anyone tell me how to print the followi
on Mon, 01 Jul 2002 18:32:27 GMT, Ned Cunningham wrote:
> Can anyone tell me how to print the following data so that it rounds
> up even though it shouldn't
> $data = "3.424";
> [...]
> I need it to round up even if it is only .001 ?
use strict;
use POSIX qw(ceil);
sub rou
EMAIL PROTECTED]'
Subject: RE: printf question
correction on my 4th line.
$data = sprintf ("%11.2f", $data + (scalar($data =~
/[1-9]$/) && 0.005) );
> -Original Message-
> Fr
correction on my 4th line.
$data = sprintf ("%11.2f", $data + (scalar($data =~ /[1-9]$/) && 0.005) );
> -Original Message-
> From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 01, 2002 2:55 PM
> To: 'Ned Cunningham'; '[EMA
ssage-
> From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 01, 2002 2:32 PM
> To: '[EMAIL PROTECTED]'
> Subject: printf question
>
>
> Hi,
>
> Can anyone tell me how to print the following data so that it
> rounds up even
> thoug
Hi,
Can anyone tell me how to print the following data so that it rounds up even
though it shouldn't
$data = "3.424";
Printf WRFILE ("%11.2f", $data);
My results are
3.42
I need it to round up even if it is only .001 ?
TIA
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio