- #1
- 354
- 11
- TL;DR Summary
- Excel giving strange results. Seems to fail for taking square roots of very large odd powered numbers.
Is it always true that the square root of an odd powered integer will always be irrational?
What about ##\sqrt{4^3} = 8##?Summary:: Excel giving strange results. Seems to fail for taking square roots of very large odd powered numbers.
Is it always true that the square root of an odd powered integer will always be irrational?
Take any positive integer ##n##. Either:Well, actually 4^3 can be expressed as (2^2)to the third power or (2^3)squared. What I meant is an integer that cannot be expressed as a square and then raised to an odd power. Would not such an integer raised to an odd power always yield an irrational number when the square root is taken?
Fail in what way?Summary:: Excel giving strange results. Seems to fail for taking square roots of very large odd powered numbers.
Whether something is irrational or not has absolutely no bearing on the accuracy of any compution in Excel.Is it always true that the square root of an odd powered integer will always be irrational?
Except, of course, to the extent that no irrational number can be a model number in IEEE 754 floating point. An integer might or might not be.Whether something is irrational or not has absolutely no bearing on the accuracy of any compution in Excel.
Excel rounds off the square root of a very large odd powered integer so that it gives an integer value. I have tested this with very large numbers. This is why I needed to research if the square root of odd powered integers always yields an irrational number. Excel like any other computer programs have a limitation on their accuracy.Fail in what way?
Whether something is irrational or not has absolutely no bearing on the accuracy of any compution in Excel.
Can you give an example? "Very large" is not very exact.Excel rounds off the square root of a very large odd powered integer so that it gives an integer value. I have tested this with very large numbers. This is why I needed to research if the square root of odd powered integers always yields an irrational number. Excel like any other computer programs have a limitation on their accuracy.
Excel rounds off the square root of a very large odd powered integer so that it gives an integer value. I have tested this with very large numbers. This is why I needed to research if the square root of odd powered integers always yields an irrational number. Excel like any other computer programs have a limitation on their accuracy.
Raise 7 to the 39th power in excel and then take the square root. The answer should be an irrational number but it shows up as an integer with zeroes in the decimal place.Can you give an example? "Very large" is not very exact.
Edit: figured it out for you...
By default, Excel displays cells in "General" format. Using this format, you can put a formula into a cell and see a number displayed. For instance, =sqrt(3^41).
Under the default "General" format, this displays as 6039287738
Under the "Number" format, this displays as 6039287737.57
Under the "Accounting" format, this displays as 6,039,287,737.57
Under the "Number" format with 10 decimal places, this displays at 6039287737.5706100000
One assumes that those last five digits were simply zero filled. That is 15 or maybe 16 decimal digits of precision. Which is about right for a 64 bit IEEE float.
When I try I get (same as using Python):Raise 7 to the 39th power in excel and then take the square root. The answer should be an irrational number but it shows up as an integer with zeroes in the decimal place.
3.01586E+16 |
15 digits of precision displayed, followed by zeroes. The underlying implementation is 64 bit floating point. Apparently rounded to 15 decimal digits.Raise 7 to the 39th power in excel and then take the square root. The answer should be an irrational number but it shows up as an integer with zeroes in the decimal place.
The IEEE 754 Standard for floating point 64-bit numbers maintains slightly over 15 decimal digit precision. See https://en.wikipedia.org/wiki/IEEE_754.15 digits of precision displayed, followed by zeroes. The underlying implementation is 64 bit floating point. Apparently rounded to 15 decimal digits.
Right. But Excel seems to consistently chop them off at 15.The IEEE 754 Standard for floating point 64-bit numbers maintains slightly over 15 decimal digit precision. See https://en.wikipedia.org/wiki/IEEE_754.
[itex]39\log7 \approx 32.96[/itex]. I would not expect the result of [itex]7^{39}[/itex] to be accurate, still less the result of the square root.Raise 7 to the 39th power in excel and then take the square root. The answer should be an irrational number but it shows up as an integer with zeroes in the decimal place.
Nicely designed experiment. The result is 120. Based on this result, the intermediate result used by Excel was 12345678987654320 exactly. This fits the IEEE 754 expectation.You can check if it has the next digit internally if you calculate 111111111*111111111 - 12345678987654200. Is the result 100 or something close to it?
10 1011 1101 1100 0101 0100 0110 0010 1001 0001 1111 0100 1011 0001
<---------------------------- 52 bits -------------------------->
^ ^
One "hidden" bit from normalization One bit not expressed
Excel like any other computer programs have a limitation on their accuracy.
But again this has nothing to do with rational vs irrational: Excel does not calculateRaise 7 to the 39th power in excel and then take the square root. The answer should be an irrational number but it shows up as an integer with zeroes in the decimal place.
sqrt(7^40)
exactly either.Windows 10 Calculator shows 111111111 x 111111111 = 12345678987654321 ##-## maybe the Excel guys should try to glean something from the Calculator code, now that it's open source (github.com/microsoft/calculator).You can check if it has the next digit internally if you calculate 111111111*111111111 - 12345678987654200. Is the result 100 or something close to it?
Yeah, when I increase the number of 1s to 17, the result is 1.2345679012345678765432098765432e+32.Windows Calculator uses arbitrary precision arithmetic (some of the time) which requires a different set of choices for dealing with edge cases from arithmetic using numbers stored using IEEE 754.
The limitations of IEEE 754 are well suited to (and well understood by computational experts in) almost all applied scientific and financial purposes, which is what Excel is mainly used for.
If you want arbitrary precision, rational or Big Integer arithmetic then use a package that supports that.
Zimbabwe would like to have aand everything works fine as long as you are dealing with less than 720 trillion dollars or so.
ASCII 0x20 is " " (space). Don't blame the computer - as usual, the error can be traced to one or more inept programmers.The last digits are caused by actual account transactions, and a computer error added a lot of 0x20 bytes to it.
" "
in my bank account please. That should be free, right?Yes, although that statement might easily be misunderstood by someone who hasn’t been through the wars. As many pre-IEEE floating point designs demonstrated, “exact and predictable” does not preclude “bizarre and surprising”.However, floating point has exact and predictable behavior.
Are you suggesting something like...The nth root of x given by =int(x^(1/n)) in Excel is an integer ;)
It was just an attempt at a joke, but per the OP x would be a^some odd power and n would be 1/2Are you suggesting something like...
Put some positive integer into A1
Put some positive integer into A2
Put =A1^A2 into A3
Put =INT(A3^(1/A2)) into A4
Observe that A4 is equal to A1 unless an overflow has occurred while computing A3
Did you notice that if you write any of those irrational square roots as a continued fraction, they always repeat.From the research I have done since posting, it says that the square root of any non-square integer is always an irrational number.
What about 1?Is it always true that the square root of an odd powered integer will always be irrational?