How does a calculator find square roots?

preview_player
Показать описание

Chapters:
0:00 I'm a little autistic
1:06 Calculate square roots by hand
3:47 My first calculator
5:35 How a calculator finds square roots
10:17 Summary
Рекомендации по теме
Комментарии
Автор

Do you know for a fact that this is the way calculator calculated square roots? (Did you dig into the code?) There are much simpler ways without using heinous mathematical approximations! There is Newton's method (using division & addition only, but requires iterations until it converges), but there is one better! This one manipulates bits & & uses subtraction only!
It is derivative of the hand method you show at the start, but done in binary. First, the number is adjusted (left/right shift of the mantissa) making exponent term even. Exponent term of the result will be half this. The new mantissa is calculated by the hand method, except in binary. The simplification going to binary is unbelievable! Pair the digits. Put 1 over the first non-zero pair (will be the left most pair if the number is normalized). Subtract the 1 to get remainder. Bring down the next pair. Now in hand method, you have in 10 options for the next digit, but only 9 need to be tested. In binary, you have 2 options, but only 1 need be tested. In hand method, you double the existing answer. You do the same in binary, but do that by simply appending 0 to the right. In hand method, you carry out multiplication, both appending test digit & using it for multiplier. In binary, you append a 1 to the right of the 0, then multiply that by 1. (But you don't actually need to multiply by 1 as that's just the same number.) If it is not larger than remainder, subtract from remainder & write 1 for the next digit of answer. If it is larger then remainder, discard the subtract & write 0 for next digit of answer. (This whole thing boils down to appending 0 1 to the right & testing against the remainder.) Even 64 bit math requires only 64 iterations, each little more complex than a divide iteration being only bit shifts & subtraction.
Advantages: first, manipulating bits is much easier for computers than doing math. Second, there is no doubt when to stop the iterations (answer is accurate to the number of digits calculated).

bpark
Автор

- yo whats the square root of 144?
- holup let me draw the bus stop

white_
Автор

Old calculators are not slow. You just have to know how to use them. Even the slowest calculator makes a human look like he's standing still.

johnchestnut
Автор

Next up: Homeless man recounts how he lost his calculator, assumes it was stolen

tomr
Автор

I took that punch personally. You will hear from my lawyer.

UpdateFreak
Автор

I think it is better to pronounce it as "cosine inverse" rather than "cos minus one"
Edit 1: Honourable mention from replies
1. decos
2. cos root
3. arcus cosinus
4. cos upper

pranaypallavtripathi
Автор

Back in my college days, over 50 years ago, we used mechanical calculators, Brunsviga & Muldivo. Watching them do a calculation was fun. Then we got an electronic desktop calculator made by Monroe.

My first was a Texas TI 50 (I think).

One night in a pub, we met a guy, with a super-duper Texas (his employer's), that could do all sorts of things. He asked it for the sqrt of a number, and we went for a drink, while it worked it out.

Even, worse, there were some calculators that worked in Reverse Polish Notation.

rjones
Автор

This video is partly incorrect. The vast majority of calculators from the 80s (and still some calculators today) store numbers in binary-coded decimal, not as binary ints or floats. So a number like 869.2 would be stored essentially as-is. Something like with an additional byte to indicate the position of the decimal point and another for the sign. The Casio has the advantage of a higher clock speed, hardware multiplication and division, additional memory and ROM (for lookup tables and such), and some other features that make it faster and more accurate than the one from the 80s, but it still has no FPU. (The only types are signed and unsigned ints of 8 to 64 bits.) It's a misconception that BCD was only used for 7-segment LCD displays; many calculators like the TI-84, -89, and -92 with bitmapped displays still use it. Even if the Casio does use a binary format internally, it uses hardware "decimal correction" addition and multiplication for the same purpose. So although technically the calculations may be done in binary, in practice, they will produce the same results as pure BCD arithmetic.

The details of exactly how the calculator works are hard to find, so some of what I said might be wrong. But the lack of any FPU in the nX-U8/100 demonstrates conclusively that that it only operates directly on integers, whether binary or BCD. At least one 2003 source ( _Decimal Floating-Point: Algorism for Computers_
by Michael F. Cowlishaw
) does claim that Casio calculators use a 15-digit decimal format. Also, since the nX-U8/100 has hardware multiplication, CORDIC is not strictly the fastest algorithm available (though it might be used anyway).

EebstertheGreat
Автор

🗣🗣🗣 "I walked up to it and then I stole it"

govindkrishnalb
Автор

"Now you know how a calculator finds square roots."
Nope, I don't.

davidjacobs
Автор

I have tried a number of newer calculators over the years, but I keep coming back to the HP 48GX from the mid 90s. Nothing else has impressed me as much.

dono
Автор

There’s a much easier way. 25 is close to start with. Divide 869 by 25 and you get ~34. Calculate the average (25+34)/2 and you get 29.5 Divide 869 by 29.5 and you get 29.457. Now calculate the average (29.5+29.457) you get something and you divide 869 by that number. Remember that when you divide a number by its square root, you get the square root. Divide by something else and the square root is between what you divide by and what you get

TheFrewah
Автор

Im confused hitting it with a log should of worked?

atomkcreeper
Автор

Your mother was a real one for finishing college with that calculator fr

eyad
Автор

I looked square root up, in a book on C. Assuming the input was a float, it took the exponent and divided by 2.
The result was a first approximation, which fed into a Newton-Raphson algorithm for about five loops.
A decent first guess means the result converges quickly.

Soupie
Автор

I started engineering without a calculator. We all had slide rules. I learned a lot of ways to calculate things in my head - including square and cube roots.

jairus
Автор

I swear the fact that you hit that calculator with a log and just a fraction of a second after I get an ad was the funniest moment I had today 😂

maitreaco
Автор

ok slight problem and im like 99% sure this entire video is incorrect, the Chebyshev polynomials use a square root lol. You can't solve a square root problem using them because it introduces another square root.

MyNameIsSalo
Автор

Underrated channel I’m glad i found, looking forward to more content. Good luck buddy!

OisinDoyle
Автор

I got an ad right after the log hit the calculator, and it cut off the bang sound in the most beautiful way, thank you for making my day even more magical

joemiller