[llvm-commits] [test-suite] r109240 - in /test-suite/trunk/SingleSource/Benchmarks/Misc-C++/Large: sphereflake.cpp sphereflake.reference_output sphereflake.reference_output.small

Bob Wilson bob.wilson at apple.com
Fri Jul 23 13:17:42 PDT 2010


Yeah, I figured that we could round more bits away as needed.  For now, 1 bit is good enough to make the results consistent across MacOS and iOS.  There is a lot of repetition in the values passed to sin() and cos() in this test, and I don't think it's pushing the limits of accuracy at all.  If we have to round more than a few bits, I like your suggestion of rounding to float.  I was trying to keep it as close as possible to the original test for now.

On Jul 23, 2010, at 12:40 PM, Stephen Canon wrote:

> Bob --
> 
> 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.
> 
> - Steve
> 
> 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
>> Log:
>> Round the results of sin() and cos() to make the output of this test
>> consistent across platforms.





More information about the llvm-commits mailing list