These are the old pages from the weblog as they were published at Cornell. Visit for up-to-date entries.

September 18, 2003

Floating Point Error

There was an issue with the CLI microbenchmarks results that kept nagging me, and that surfaced again in full force when I transformed the benchmark code into smaller methods. Basically the floating point performance was mediocre compared with the integer performance. I always had intended to look closer at it but because bosh JVM and CLI exhibited the same behavior it escaped scrutiny for a while.

When moving the code to smaller methods suddenly the multiplication and divide tests jumped in performance beyond reason; up to 50 times the original results. I first looked at the x86 assembly assuming the JIT was doing some very smart but I couldn't find a thing.

It turned out to be something very more obscure: the single method code re-used the results of the "add" operations as input to the "multiplication" and the "divide". The "add" execution basically ran so fast that it resulted an "infinite" result.

This caused all the operations to execute overflow exceptions, So the benchmarks were not registering fp performance but fp exceptions handling. I assume the Java Grande benchmarks were developed for architectures that ran on significantly slower floating point hardware than in modern P4 machines.I did some tweaking of the code to avoid the infinite result and the improved numbers are in the presentation that I will post tomorrow.

This does mean that my foating point numbers in the sc2003 and the IEE Software papers are wrong. Unfortunately the reviewers didnít catch this either. I am going to see whether I can get at least the journal paper updated.

Posted by Werner Vogels at September 18, 2003 12:32 AM