On Thu, Apr 29, 2010 at 3:29 PM, Sean Owen <sro...@gmail.com> wrote: > You mean "sum * Math.log(sum)"? >
Of course. Sorry. > javac definitely isn't allowed to do that kind of transformation -- it > actually can't do much of anything. > Javac and the JIT both know that log is a pure function. They also definitely do constant sub-expression elimination and strength reduction. Besides since logSum is a local variable there can be no side-effects.