square-root Questions

8

Solved

I wrote this code for generating Continued Fraction of a square root N. But it fails when N = 139. The output should be {11,1,3,1,3,7,1,1,2,11,2,1,1,7,3,1,3,1,22} Whilst my code gives me a sequence...
Sonority asked 29/8, 2012 at 16:43

2

Solved

I am trying to analyze the time complexity of the default integer square root function in Python 3.8+ versions, math.isqrt() I have tried to peruse the time complexity of this function as a functio...
Furlough asked 26/2, 2024 at 18:53

4

Solved

I'd like to calculate the square root of a number bigger than 10^2000 in Python. If I treat this number like a normal integer, I will always get this result back: Traceback (most recent call last)...
Danie asked 17/12, 2017 at 11:29

3

Solved

Is there any faster or more direct way of computing the integer square root: http://en.wikipedia.org/wiki/Integer_square_root in C# as private long LongSqrt(long value) { return Convert.ToInt64...
Succinate asked 15/5, 2014 at 7:41

4

Solved

What is the difference between x**(1/2) , math.sqrt() and cmath.sqrt()? Why does cmath.sqrt() get complex roots of a quadratic right alone? Should I use that for my square roots exclusively? What...
Herminiahermione asked 13/11, 2015 at 2:25

7

Solved

I am currently searching for a very fast integer square root approximation, where floor(sqrt(x)) <= veryFastIntegerSquareRoot(x) <= x The square root routine is used for calculating prime nu...
Dejecta asked 9/12, 2015 at 19:17

9

Solved

In maths, if I wish to calculate 3 to the power of 2 then no symbol is required, but I write the 2 small: 3². In Python this operation seems to be represented by the ** syntax. >>> 3**2 9 ...
Kuomintang asked 8/10, 2013 at 18:8

6

John Carmack has a special function in the Quake III source code which calculates the inverse square root of a float, 4x faster than regular (float)(1.0/sqrt(x)), including a strange 0x5f3759df con...
Grilse asked 28/8, 2009 at 21:43

3

Solved

I would like to simplify the square root of an integer algebraically, not compute it numerically, i.e. √800 should be 20√2 , not 28.2842712474619. I cannot find any way to solve this through progr...
Champagne asked 8/5, 2012 at 5:8

5

Solved

I'm using a BigInteger object. With normal ints or longs, I can use Math.pow(number, 1/nth root) to get the nth root. However, this will not work with a BigInteger. Is there a way I can do this? ...
Herold asked 15/6, 2015 at 20:48

2

Solved

I was looking for the fastest method to calculate the square root(integer) of a number(integer). I came across this solution in wikipedia which finds the square root of a number(if its a perfect sq...
Appellant asked 2/6, 2012 at 21:32

20

Is there a library that will find the square root of a BigInteger? I want it computed offline - only once, and not inside any loop. So even computationally expensive solution is okay. I don't want...
Zedekiah asked 10/12, 2010 at 10:24

1

Solved

Below I have adapted code from William Kahan and K.C. Ng (look at the comment block on the bottom) written in 1986 to produce an approximation of 1 / sqrt(x) where x is an IEEE-754 double precision...

3

Solved

I have seen floating point bit hacks to produce the square root as seen here fast floating point square root, but this method works for floats. Is there a similar method for finding the integer squ...
Juneberry asked 1/2, 2021 at 1:27

14

I am looking for a fast, integer only algorithm to find the square root (integer part thereof) of an unsigned integer. The code must have excellent performance on ARM Thumb 2 processors. It could b...
Ignore asked 8/7, 2009 at 19:29

8

Solved

I'm trying to learn algorithms and coding stuff by scratch. I wrote a function that will find square roots of square numbers only, but I need to know how to improve its performance and possibly ret...
Ninos asked 7/3, 2016 at 22:54

15

How is the square root function implemented?
Gravettian asked 27/8, 2010 at 5:25

1

Solved

I need to implement an RMS calculations of sine wave in MCU (microcontroller, resource constrained). MCU lacks FPU (floating point unit), so I would prefer to stay in integer realm. Captures are di...
Arteriole asked 9/5, 2020 at 14:36

6

I have been trying to figure out how to programmatically find a square root of a number in Swift. I am looking for the simplest possible way to accomplish with as little code needed. I now this is ...
Lavinalavine asked 30/6, 2015 at 19:9

6

Solved

There are a couple of ways to find integer square roots using only integer arithmetic. For example this one. It makes for interesting reading and also a very interesting theory, particularly for my...
Zelig asked 11/1, 2012 at 21:21

12

Can we compute the square root of a BigDecimal in Java by using only the Java API and not a custom-made 100-line algorithm?
Primula asked 30/11, 2012 at 17:4

5

Is it possible to calculate the distance between two points without having to use the math.h library? I know that, using the math.h library, it would have to be something among these lines (Euclide...
Sailer asked 3/5, 2013 at 19:3

2

Solved

The answer gives the following code for computing floor(sqrt(x)) using just integers. Is it possible to use/modify it to return ceil(sqrt(x)) instead? Alternatively, what is the preferred way to ca...
Defeatism asked 8/7, 2018 at 16:0

4

Solved

Reading through The Tricks of the 3D Game Programming Gurus, I came across this sort function written in inline assembly: inline float FastSqrt(float Value) { float Result; _asm { mov eax, Va...
Amiens asked 21/1, 2017 at 22:54

2

Solved

I noticed that calculating the integer part of square root of uint64_t is much more complicated than of int64_t. Please, does anybody have an explanation for this? Why is it seemingly much more dif...
Tram asked 6/12, 2017 at 20:40

© 2022 - 2025 — McMap. All rights reserved.