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'; '[EMAIL PROTECTED]' > Subject: RE: printf question > > > I don't know what accuracy you need.. but: > > #my $data = "3.420"; > my $data = "3.424"; > $data = sprintf ("%11.3f", $data); > $data = sprintf ("%11.2f", $data + scalar($data =~ /[1-9]$/) / 100 ); > > printf ("%11.2f\n", $data); > > > -----Original Message----- > > 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 > > 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 additional commands, e-mail: [EMAIL PROTECTED] > > > > -------------------------------------------------------------- > -------------- > -------------------- > The views and opinions expressed in this email message are > the sender's > own, and do not necessarily represent the views and opinions of Summit > Systems Inc. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]