They still look like function calls to me, but given the performance 
difference, I would be surprised if they are as accurate. sin is >4x faster 
for Float64, which is on par with VML with 1 ulp accuracy, but VML has the 
benefit of vectorization. Indeed, if 
this<http://www.opensource.apple.com/source/Libm/Libm-315/Source/Intel/sincostan.c>is
 the right file:

If the rounding mode is round-to-nearest, return sine(x) within a
few ULP.  The maximum error of this routine is not precisely
known.  The maximum error of the reduction might be around 3 ULP,
although this is partly a guess.  The polynomials have small
errors.  The polynomial evaluation might have an error under 1
ULP.  So the worst error for this routine might be under 4 ULP.


On Thursday, April 17, 2014 4:26:07 PM UTC-4, Stefan Karpinski wrote:
>
> Apple's libm is very good, which may explain some of this, but my guess is 
> that LLVM is clever enough to notice calls into the system libm and replace 
> them with x86 instructions for the same functions. The hardware 
> implementations are fast but don't always have the same accuracy as 
> openlibm. Other operating systems don't have nearly as good default libm's 
> – they are often inaccurate, slow, or both.
>
>
> On Thu, Apr 17, 2014 at 4:07 PM, John Travers <[email protected]<javascript:>
> > wrote:
>
>> For a function which contains many calls to exp, sin, cos I got about a 
>> 4x performance boost by compiling with USE_SYSTEM_LIBM=1. Is this expected? 
>> Why exactly does Julia bundle and default to using its own libm? For 
>> consistency and accuracy? I'm on the latest MacBook Pro with a Haswell 
>> CPU - maybe this is to do with AVX?
>>
>>
>

Reply via email to