Top "Sqrt" questions

The `sqrt` function returns the positive square root of a number in several programming languages.

sqrt() of int type in C

I am programming in the c language on mac os x. I am using sqrt, from math.h, function like …

c int double sqrt
Difference between sqrt(x) and pow(x,0.5)

I was wondering why there is sqrt() function in C/c++ as we can achieve the same using pow(x,0.5); …

c++ c sqrt
Where can I inspect Python's math functions?

I would like to look at the way Python does computes square roots, so I tried to find the definition …

python math sqrt
Very fast approximate Logarithm (natural log) function in C++?

We find various tricks to replace std::sqrt (Timing Square Root) and some for std::exp (Using Faster Exponential Approximation) , …

c++ math logarithm micro-optimization sqrt
Negative square root

How do you take the square root of a negative number in C++?I know it should return a real …

c++ math sqrt
Fast sqrt in Java at the expense of accuracy

I am looking for a fast square root implementation in Java for double values in the input range of [0, 2*10^12]. For …

java performance math sqrt
What's the way to determine if an Int is a perfect square in Haskell?

I need a simple function is_square :: Int -> Bool which determines if an Int N a perfect square (…

algorithm haskell sqrt
I'm getting an error <string>:149: RuntimeWarning: invalid value encountered in sqrt while generating a list

def ellipse(numPoints, genX=np.linspace, HALF_WIDTH=10, HALF_HEIGHT=6.5): xs = 10.*genX(-1,1,numPoints) ys = 6.5*np.sqrt(1-(xs**2)) return(…

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

I find myself typing double foo=1.0/sqrt(...); a lot, and I've heard that modern processors have built-in inverse square root …

c++ c double sqrt
Determining if square root is an integer

In my program, I am trying to take the find the largest prime factor of the number 600851475143. I have made …

c++ arrays loops math sqrt