Search code examples
pythonperformanceinversesquare-root

inverse square root in Python


Does any Python library offer a function that implements the "fast inverse square root" algorithm described in following link? http://en.wikipedia.org/wiki/Fast_inverse_square_root Perhaps numpy/SciPy?


Solution

  • You can already do the inverse square root just do x**-1/2 so you don't need to make a complicated function to do it and its probably faster to do it this way anyway and its much easier

    and like interjay said if you're really worried about the speed of something like that you probably should use a faster more exact language to get a faster way

    the only library that maybe has it that i found is mpmath

    Good Luck!!