# Talk:Square root by hand

## Weaknesses of initial VB.NET algorithm

Just noting where improvements could be made...

1. Depends on BigIntegers, which start consuming a considerable amount of memory as the number of digits escalates.

2. Computes and checks 1 to ten "next" digits (average 5?) instead of predicting a guess, then checking it once or twice.--Enter your username (talk) 20:31, 12 October 2020 (UTC)

- At heart, it appears to be the same algorithm as my Phix entry, just "de-generalised". --Pete Lomax (talk) 23:45, 12 October 2020 (UTC)

## What is a number?

The task description should be more specific regarding meaning of number. Perhaps including example test cases and output. Presumably the number should not be negative. Should the output include the decimal point when and where appropriate? I'd suggest testing 2, 0.2 and 10.89, with output showing decimal point correctly. With √2 to 480 or 500 decimal places or integers.--Nigel Galloway (talk) 15:38, 14 October 2020 (UTC)

- spigot_sqrt(pi_to_100dp), squared, to 100dp? - not sure how much of a stress test that really is.. (my maths is so crap I expected the root would have to be accurate to maybe 200dp, or at least 150dp, but apparently not.) --Pete Lomax (talk) 14:59, 15 October 2020 (UTC)

## REXX

What is the meaning of the second argument?

- The second argument is used to specify the number of decimal digits to be displayed (spit). -- Gerard Schildberger (talk) 18:29, 1 August 2021 (UTC)

The REXX Version shows:

output when using the inputs of: .2 80 .4472135954999579392818347337462552470881236719223051448541794490821041851275609

If 80 digits are required, the result should be

.44721359549995793928183473374625524708812367192230514485417944908210418512756098

--Walter Pachl 16:17, 1 August 2021 (UTC)

- The REXX program was incorrectly not accounting for the displaying of the decimal point (as it was counting it as a decimal digit). The program has been corrected. -- Gerard Schildberger (talk) 18:22, 1 August 2021 (UTC)

- Also note that REXX program doesn't round the result (digits being displayed/spit). -- Gerard Schildberger (talk) 18:29, 1 August 2021 (UTC)
- Actually, in my opinion it should (round for the last digit) to get correct 80 digits!

.44721359549995793928183473374625524708812367192230514485417944908210418512756097988288288167575 .44721359549995793928183473374625524708812367192230514485417944908210418512756097

- --Walter Pachl 18:54, 1 August 2021 (UTC)

- In order to round, the REXX program would have to compute the
*next*decimal digit. Bear in mind that the last decimal digit has already been computed and displayed (spit) to the terminal screen, so rounding in a spigot algorithm could entail*backing up*and changing (undoing) the previous decimal digit that was already just displayed (spit). With irrational numbers, there is no correct last decimal digit. Spigot algorithms are not designed for rounding, but for spitting digits one at a time. Rounding can be incorporated into the routine (by withholding one decimal digit), but would unnecessary complicate any program and make the comparisons of computer programming languages more problematic. -- Gerard Schildberger (talk) 20:38, 1 August 2021 (UTC)- I see. Thanks. --Walter Pachl 06:02, 2 August 2021 (UTC)

- In order to round, the REXX program would have to compute the