sounds more like a bug than a tweek
caperjack
I hate 20 Questions
13,069 posts since Aug 2003
Reputation Points: 1,064
Solved Threads: 812
It's the same "problem" as the other user who posted a similar "problem". The problem is that you do not understand how computers store and process floating point numbers. The square root function uses a floating point algorithm. The square root of 9 is not (according to the algorithm) exactly 3. It is 3 plus 1.155e-37. Because the decimal part is so small compared to the integer part it it not displayed. However, when you subtract 3 you are left with only the decimal part which can be displayed in scientific notation. I suppose the original answer could have been displayed as 4 + 1.155e-37 but that would be silly.
Reverend Jim
Posting Shark
1,161 posts since Aug 2010
Reputation Points: 253
Solved Threads: 158
I believe the actual algorithm is Newton's method. You start with a guess as to the answer then iterate through a formula to get the next approximation. Repeat as needed. It converges very quickly to the answer.
Example - find the square root of 10. Let's guess that it is 2 (it's not a good guess but it doesn't matter). To find the next approximation we divide the original number by our guess, add it to our guess then divide the result by 2.
(2 + 10/2) / 2 = 3.5
3.5 squared is 12.25
(3.5 + 10/3.5) / 2 = 3.178571429
3.178571429 squared is 10.10331633
(3.178571429 + 10/3.178571429) / 2 = 3.162319422
3.162319422 squared is 10.00026413
etc. Each iteration gets us closer to the actual square root. All of it requires floating point arithmetic.
Reverend Jim
Posting Shark
1,161 posts since Aug 2010
Reputation Points: 253
Solved Threads: 158
It's ok that microsoft neglected that error. But what made me suprised and shocked is that they never fixed that bug in any of the version of windows starting from sp1 to latest windows 7.
That is incorrect!!
Im on Win98se and when i do a square root of 3 find i get the correct response
1.73205080756887729352744634150587
The Dude
Nearly a Senior Poster
3,485 posts since Dec 2005
Reputation Points: 1,054
Solved Threads: 31
That's because the OP got the numbers wrong. He/she meant to enter 9, then take the square root, then subtract 3. This has been posted elsewhere.
Reverend Jim
Posting Shark
1,161 posts since Aug 2010
Reputation Points: 253
Solved Threads: 158
OK i just got the square root of 9 which is 3
Then i hit - (Minus sign) and hit 3 and i got this answer
4.2133833890964759959853688320845e-38
The Dude
Nearly a Senior Poster
3,485 posts since Dec 2005
Reputation Points: 1,054
Solved Threads: 31
Hehehe i dont understand :D
The Dude
Nearly a Senior Poster
3,485 posts since Dec 2005
Reputation Points: 1,054
Solved Threads: 31
Asked and answered twice. I'm not going to explain it again.
Reverend Jim
Posting Shark
1,161 posts since Aug 2010
Reputation Points: 253
Solved Threads: 158