Is there any reason to think that sin and cos can be computed jointly more efficiently than computing each one independently?
> On Jul 28, 2014, at 12:21 AM, Ken Bastiaensen <[email protected]> > wrote: > > Thank you for your answers. Yes, it seems sincos is slower than calling (sin, > cos) at the moment. > I don't know about libm standards, but if it's available in openlibm, why not > export it? > > Ken > > >> On Sun, Jul 27, 2014 at 8:26 PM, Viral Shah <[email protected]> wrote: >> Is sincos a standard libm function? >> >> Also, I wonder if creating the one entry array is too expensive, and if we >> should just call sin and cos separately. The vectorized version may be able >> to benefit from calling sincos directly. >> >> -viral >> >> >>> On Monday, July 28, 2014 1:02:06 AM UTC+5:30, Isaiah wrote: >>> It doesn't appear to be wrapped, but you can call it yourself like this: >>> >>> julia> sincos(x) = begin psin = Cdouble[0]; pcos = Cdouble[0]; >>> ccall(:sincos, Void, (Cdouble, Ptr{Cdouble}, Ptr{Cdouble}), x, psin, pcos); >>> (psin[1], pcos[1]); end >>> sincos (generic function with 1 method) >>> >>> julia> sincos(pi) >>> (1.2246467991473532e-16,-1.0) >>> >>> Feel free to open an issue or pull request if you think it should be >>> exported - might have just been an oversight. >>> >>> >>>> On Sun, Jul 27, 2014 at 3:25 PM, Ken B <[email protected]> wrote: >>>> Hi, >>>> >>>> I want to calculated sine and cosine together of the same angle. I saw >>>> this function is implemented in openlibm, but is it available in julia and >>>> how? >>>> >>>> https://github.com/JuliaLang/openlibm/blob/18f475de56ec7b478b9220a5f28eb9a23cb51d96/src/s_sincos.c >>>> >>>> Thanks! >>>> Ken >
