Author |
Message |
UraniumLobster
|
Posted: Wed Sep 12, 2007 9:31 am Post subject: How do you do square roots on turing? Im new so... |
|
|
Just wanted to know how you use square roots/cube roots in turing. I have to make a calculator which is simple I just don't know/remember how to square root a number. I haven't programmed in over 3 years, and it has slipped my mind... |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Wed Sep 12, 2007 10:16 am Post subject: RE:How do you do square roots on turing? Im new so... |
|
|
If I recall correctly, you might want to check out something along the lines of sqrt(). Also remember F10 is your friend. |
|
|
|
|
|
Tony
|
Posted: Wed Sep 12, 2007 11:19 am Post subject: RE:How do you do square roots on turing? Im new so... |
|
|
You could just use exponents
sqrt(x) = x**0.5 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Clayton
|
Posted: Wed Sep 12, 2007 3:45 pm Post subject: RE:How do you do square roots on turing? Im new so... |
|
|
Yes. Remember that x^1/n is the nth root of that number. So 8^1/3 will give you 2 (the cube root of 8) |
|
|
|
|
|
Mazer
|
Posted: Wed Sep 12, 2007 5:48 pm Post subject: Re: RE:How do you do square roots on turing? Im new so... |
|
|
rdrake @ Wed Sep 12, 2007 10:16 am wrote: If I recall correctly, you might want to check out something along the lines of sqrt(). Also remember F10 is your friend.
And on that note, so is F9 unless they changed something. |
|
|
|
|
|
Clayton
|
Posted: Wed Sep 12, 2007 7:19 pm Post subject: RE:How do you do square roots on turing? Im new so... |
|
|
F9 will give you the page for the keyword your cursor is blinking on, F10 will just open up the help manual. |
|
|
|
|
|
Dabond
|
Posted: Wed Oct 17, 2007 10:21 am Post subject: Re: How do you do square roots on turing? Im new so... |
|
|
"number"**"exponent" |
|
|
|
|
|
Zampano
|
Posted: Wed Oct 17, 2007 10:25 am Post subject: Re: How do you do square roots on turing? Im new so... |
|
|
On a related note, isn't it messed up that the squared number is inside the brackets uinstead of the number the be squared. It took me a long time to understand that. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Wed Oct 17, 2007 1:05 pm Post subject: RE:How do you do square roots on turing? Im new so... |
|
|
Uh, Zampano, the square root function takes a number x and returns the number that, when squared, gives x. You might say sqrt(x^2) = x (ie. sqrt and f(x) = x^2 are inverse functions when defined on the positive reals). So it does make sense that the squared number is the parameter to sqrt.
Follow? |
|
|
|
|
|
|