Re: Help with Stupid question
- From: peterc@xxxxxxxxxxxxxx (Peter Cornelius)
- Date: Mon, 17 Jul 2006 12:01:08 -0700
printf will round. Try it:
printf ("should be 25.8 : %.1f$/", 25.79);
prints:
should be 25.8 : 25.8
Just one caveat here: as I understand it, sprintf() will not round the
decimal, it will just truncate it, so if you need to round up or down
the number, I would suggest looking through the math modules.
Peter Cornelius
Sr. Software Engineer
LiveOps (http://liveops.com)
.
- References:
- Help with Stupid question
- From: Ralph H. Stoos Jr.
- Re: Help with Stupid question
- From: Tom Phoenix
- RE: Help with Stupid question
- From: Timothy Johnson
- Help with Stupid question
- Prev by Date: Re: Newbie Perl Question
- Next by Date: Re: Help with Stupid question
- Previous by thread: RE: Help with Stupid question
- Next by thread: Re: Help with Stupid question
- Index(es):
Relevant Pages
|
|