Re: Variable division, assignment and sprintf in one line



$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
.



Relevant Pages

  • Re: Any problems with massive loop unrolling on 8088?
    ... >> looking into just generating the raw REP MOVS and REP STOS. ... > generated, `xchg cx,ax` is one byte. ... > at compile time, then limited unrolling makes sense. ... please re-read my original post -- I don't think you understand what I ...
    (comp.lang.asm.x86)
  • Re: Events and delegates
    ... > Assuming that the event is formed in a normal manner, though, you can ... You knew, at compile time, that ... it's "evt". ... Reflection mentioned in my original post. ...
    (microsoft.public.dotnet.languages.csharp)