ClrText ?->A:A:Rnd Frac Ans=0=>Stop:0->B Do Isz B:A?B?:Rnd LpWhile Frac Ans≠0 If Frac √Ans=0 Then 1->C:√Ans->D Else Ans->C:1->D While Frac C/4=0 2D->D:C/4->C WhileEnd For 3->E To √C Step 2 While Frac C/E?=0 DE->D:C/E?->C WhileEnd Next IfEnd If B=1 Then If A<0 Then If D=1 Then Locate 19-Int log C,3,"-" Else Locate 19-Int log D,3,"-" IfEnd IfEnd D≠1=>Locate 19-Int log C-Int log D,3,D Locate 20-Int log C,3,"√" Locate 21-Int log C,3,C Else If C=1 Then A<0=>Locate 18-Int log B-Int log D,3,"-" Locate 19-Int log B-Int log D,3,D Else If A<0 Then If D=1 Then Locate 17-Int log B-Int log C,3,"-" Else Locate 16-Int log B-Int log C-Int log D,3,"-" IfEnd IfEnd D≠1=>Locate 17-Int log B-Int log C-Int log D,3,D Locate 18-Int log B-Int log C,3,"√" Locate 19-Int log B-Int log C,3,C IfEnd Locate 20-Int log B,3,"/" Locate 21-Int log B,3,B IfEndNOTE: ?-squared √-root ≠-does not equal /-fraction "-"-"negative sign"
- The first and second Frac tests skip straight to the answer for rational numbers.
- The inputted number is rounded to the specified number of significant figures (10 in normal mode) to account for errors accumulated when multiplying surds.
- The first While loop (While is better than Do, as Do must always be run once) rationalises the denominator.
- The next two While loops simplify the surd in the numerator.
- Logs are used to position the numbers perfectly in place.
- I am currently working on logarithm, trigonometry and radian display.