√(X)2 should equal X, this is a basic rule in math. However, I was messing around and discovered something strange.
- Put in √(45)2 and hit enter.
- Then, use Ans=int(Ans). The answer should be 1, indicating that the statement above is true.
- Now, put in √(73)2 and hit enter.
- Using Ans=int(Ans) actually outputs 0, indicating that there is a decimal part to Ans, even though it just displays as 73.
Despite this, using √(73)2=73 still outputs as 1, as intended. This means there must be some sort of bug somewhere.
Quick logic from the calculator that proves that this is a bug:
- 73 = int(73 … true
- √(73)2 = 73 … true
- √(73)2 = int(√(73)2 … FALSE
After this, I made a small program with the intent to find the numbers that can cause this bug.
Ans→X // Ans is what number to start on
Repeat getKey
Repeat A=0 // Using repeat instead of for, because this needs to continue for as long as possible until it finds a bugged number.
X+1→X
√(X)^2
Ans=int(Ans→A // Check if number is bugged
End
Disp X // Display the bugged number
X→L₁(dim(L₁)+1 // Then put it to a list, which we can get later.
EndHere are just a few numbers in the list:
47, 51, 54, 57, 60, 65, 67, 73, 76, 78, 90, 92, 108, 112
Let's say we had a number, B, that could be anything. I was doing this in a program to check if B2 was an integer. Because of this bug, I am unable to do so.
If it's actually intended behavior by the calculator, how would I do this in a program to ensure it's correct every time?