HotSpot folds FP constants in a few rare cases, and I don't thing
Math.log is one of them.  For instance you can't fold "x+0.0" into "x"
in case "x" happens to be negative 0.  Math.log is a pure function so
it would be possible, but I don't think it made the short-list of hot
FP functions to optimize.

Otherwise, the JDK is total specified and JVMs routinely optimize
popular JDK calls.  e.g. various String compare calls or x.getClass
are totally inlined.

Cliff

On Dec 31 2008, 12:00 pm, "Mark H." <mark.hoem...@gmail.com> wrote:
> Folding constants in nontrivial floating-point expressions is an
> aggressive optimization that can break some subtle code.  For example,
> when building LAPACK, the file that tries to determine parameters of
> the floating-point units generally has to be compiled with no
> optimization.  I'd much rather keep that part of the optimization
> turned off, or be very selective about when it gets turned on.
> Furthermore, in some cases (FFTs on the Cell processor is the modern
> example, if I recall correctly), it's better to recompute constants on
> the fly then to look them up in a table.
>
> mfh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to