Is there a fast C or C++ standard library function for double precision inverse square root?

前端 未结 7 2024
醉话见心
醉话见心 2021-01-18 01:26

I find myself typing

double foo=1.0/sqrt(...);

a lot, and I\'ve heard that modern processors have built-in inverse square root opcodes.

相关标签:
7条回答
  • 2021-01-18 02:29

    why not try this? #define INSQRT(x) (1.0/sqrt(x))

    Its just as fast, requires less typing(makes you feel like its a function), uses double precision, as accurate as 1/sqrt(..)

    0 讨论(0)
提交回复
热议问题