Re: Variable division, assignment and sprintf in one line
- From: iaccounts@xxxxxxxxxx (Steve Bertrand)
- Date: Wed, 28 Nov 2007 19:53:56 -0500
$var = sprintf ("%.2f", $var / (1024*1024));
And it will be more efficient because the multiplication will be done
at compile time (once) and you'll only do a single division each
time. Which is also more precise, though in this case it doesn't seem
to matter.
Oh, and furthermore, if you happened to read my original post, I had
asked how to perform what you state above, WITHOUT needing the left hand
side.
Cheers,
Steve
.
- References:
- Variable division, assignment and sprintf in one line
- From: Steve Bertrand
- Re: Variable division, assignment and sprintf in one line
- From: Jenda Krynicky
- Variable division, assignment and sprintf in one line
- Prev by Date: Re: Variable division, assignment and sprintf in one line
- Next by Date: Re: fixed list combinatorics
- Previous by thread: Re: Variable division, assignment and sprintf in one line
- Next by thread: re: extracting fields from a matching line
- Index(es):
Relevant Pages
|