|
From: John R.
|
Julian Seward wrote: > Vex/valgrind-3 simulates the x87 FPU in much more detail than > the 2.4 line. In order to reduce the complexity of this simulation, > vex does all floating point at 64-bits (IEEE double) regardless > of the FPU's control-word settings, but it "pretends" to the > program to be running the FPU in its default 80-bit mode. > > I've tested this extensively on a large amount of FP code, and it > appears that the differences between 64-bit and 80-bit precision > are pretty minimal for real applications. For one thing, > any program which actually relies on 80-bit precision to get > the right answer is inherently unportable and will not work on > (eg) PowerPC; nor will it work if recompiled on x86 to use > SSE-based floating point. Depends on what you call "real applications." Some serious engineering, analysis, chemistry+physics, and statistics codes won't work properly under such a vex/valgrind-3. Such codes care about precision, track it before+during+after the calculations, and make dynamic choices based on observed trends in numerical error. They will get a different answer under vex/valgrind-3, and execute different code while doing so. This will cause a very large "false negative" report from memcheck. IEEE double extended precision (C/gcc long double) also provides a larger exponent range than plain double, and this can be the most important reason for using long double; the extra precision may be "don't care." Some PowerPC compilers implement long double as two ordinary doubles, with a usual implied value of (hi + lo * 2**d) with d <= -53. Although this does not provide all of the expected benefits for IEEE arithmetic (no expanded exponent range, no strict adherence to rounding rules, confuses software that expects -53==d, ...), in many "real applications" it does provide enough additional precision to justify the costs. So there are important practical exceptions to the claim that x86 80-bit FP (expressed in C as long double) is not portable to PowerPC. -- John Reiser, jreiser@BitWagon.com |