develooper Front page | perl.beginners | Postings from April 2002

RE: Limit floating point numbers?

From:
David Gray
Date:
April 2, 2002 05:50
Subject:
RE: Limit floating point numbers?
Message ID:
000a01c1da4d$4253a700$7800a8c0@3b2.com
> > > I have got most everything working ok. Now I need to go back over 
> > > almost 2500 lines of code and fix my floating point 
> number so they 
> > > read 1.25 instead of 1.2556. Which should round out to 1.26
> >
> > What text editor are you using? Can you just do a search 
> and replace? 
> > If that's not what you mean, please provide more useful information.
> >
> >  -dave
> 
> I am using Kedit that came standard with Red Hat Open Linux. 
> I have only had RD Linux 7.2 for almost 3 Months. As to the 
> previous question, I have not found the answer. In C++ one 
> would use sprintf($var, "%.2f", $var2); or something like 
> that. In Perl I am not sure.

Check out perldoc -f sprintf

 -dave





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About