gnuradio icon indicating copy to clipboard operation
gnuradio copied to clipboard

Come up with consequence for HAVE_SINCOS not making much sense

Open marcusmueller opened this issue 10 months ago • 1 comments

we check whether STL has ::sincos. Sounds like something the C++ standard settles for us already, or at least a feature check macro.

marcusmueller avatar Jun 08 '25 13:06 marcusmueller

yeah, sincos is a GNU extension, but it's actually slower than calling sin and cos separately. On clang, it's at least faster than that :)

on GCC, res = std::polar(1, angle); c = res.real(); s = res.imag(); is faster than sincos(angle, &c, &s) by about a factor of 30%, on clang, polar is 80% slower than sincos.

But on both, s = sin(angle); c = sqrt(1 - s * s); is faster, and thanks to trigonometric pythagoras, that's the same for reasonably behaved values. (and for $|s| < 2^{-48}$ I don't think we care that much.)

marcusmueller avatar Jun 08 '25 22:06 marcusmueller