| United States-English |
|
|
|
![]() |
HP-UX Floating-Point Guide: HP 9000 Computers > Chapter 3 Factors that Affect the Results of
Floating-Point ComputationsHow Mathematical Library Functions Affect Application Results |
|
Mathematical library functions do not always yield identical results from one system to another, from one language to another, or even from one software release to another. The reason is that computer vendors often modify these functions for any or all of the following purposes:
The art in algorithm design for math library routines is in finding the best tradeoff between accuracy and performance. Some algorithms are better than others at getting the most accurate results obtainable. For a given function, it is usually possible to design an algorithm that produces results that are accurate to within the 1/2 ULP mandated for the results of the basic operations. The most precise algorithm, however, is often unacceptably slow. Because correct rounding is not required for most mathematical functions (though it is required for basic operations and for some functions, such as sqrt), algorithm designers are free to sacrifice a small amount of accuracy in favor of better performance. As advances in algorithm design improve the speed and/or accuracy of the library functions, the results may change. Because HP modifies math functions from time to time, you should not count on always getting identical results from a given function. Instead, it is wise to assume that a library call may have an error of 1 ULP or thereabouts. As we explain in “Testing Floating-Point Values for Equality”, you should test for results within a certain range, not for an exact value. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||