[llvm-commits] [test-suite] r109240 - in /test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large: sphereflake.cpp sphereflake.reference_output sphereflake.reference_output.small
scanon at apple.com
Fri Jul 23 12:40:34 PDT 2010
sin( ) and cos( ) commonly vary by substantially more than the last bit across platforms. Even on platforms that correctly implement a range reduction (which excludes a lot of them) 3 ulps of error is not uncommon. On platforms that do not do a fully correct range reduction (those that naively use fprem1 on x86, for example), there are no correct bits in the result for suitably large inputs, and even for inputs that are nearly small multiples of pi/2 the error can be significant.
If the arguments are guaranteed to be modest, you might consider rounding the results to float and then converting back to double as a workaround (obviously this throws away a lot of information, but it makes bit-identical results very likely across platforms, though still not guaranteed). Ideally a test would either not depend on portable bit-exact results of transcendental functions, or would include a library that delivers correctly-rounded results like crlibm.
On Jul 23, 2010, at 10:43 AM, Bob Wilson wrote:
> Author: bwilson
> Date: Fri Jul 23 12:43:29 2010
> New Revision: 109240
> URL: http://llvm.org/viewvc/llvm-project?rev=109240&view=rev
> Round the results of sin() and cos() to make the output of this test
> consistent across platforms.
More information about the llvm-commits