-
Notifications
You must be signed in to change notification settings - Fork 1
/
base_calculator.txt
executable file
·54 lines (54 loc) · 1.39 KB
/
base_calculator.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str3
While 1
Input "BASE ",A
Repeat not(E
DelVar BDelVar CDelVar EDelVar Y"+→Str2
Input Str1
Str1+"++→Str1
For(X,1,length(Str1
Y+not(not(Y→Y
sub(Str1,X,1
If Ans=".
Then
1→Y
X+1→X
"
End
If inString("+-*/",Ans
Then
If Str2="+" or Str2="-
E+B→E
If Str2="+
C→B
If Str2="-
−C→B
If Str2="*
BC→B
If Str2="/
B/C→B
DelVar CDelVar Ysub(Str1,X,1→Str2
End
inString(Str3,sub(Str1,X,1
CA^not(Y)+AnsA^−Y(Ans<A→C
End
If E<0
"−→Str2
−E→E
E+Eᴇ−12→D
int(logBASE(D+not(D),A→Y
For(X,max(0,Y),Y-logBASE(ᴇ11,A),−1
If X=−1
Str2+".→Str2
Str2+sub("0"+Str3,1+remainder(int(D/A^X),A),1→Str2
If 0≥X and not(fPart(DAA/A^X)fPart(E/A^X
−99→X
End
For(X,X,0,−1
Str2+"?→Str2
End
length(Str2
For(X,1,Ans,16
Disp sub(Str2,X,min(16,1+Ans-X
End
End
End