r217 vs r218
......
33
{{{#!if a= ,b= ,f=
44
}}}
55
{{{#!wiki style="display: none; display: inline;"
6
##== 초기화 ==
6
##== 변수 설명 ==
77
'''as''' : "a" value to string; '''bs''' : "b" value to string;
88
'''al''' : "a" string length (integer); '''bl''' : "b" string length (integer)
99
'''ad''' : "a" decimal point (integer); '''bd''' : "b" decimal point (integer);
......
1717
'''ru''' : "result" upper value (integer→string); '''rb''' : "result" below value (integer→string);
1818
'''rp''' : "result" # of places of decimal (integer);
1919
'''rs''' : "result" suprerior value (integer→string); '''ri''' : "result" inferior value (integer→string);
20
'''i''' : index; '''tu''' : temporary value 1 (integer); '''tv''' : temporary value 2 (integer); '''tw''' : temporary value 3 (integer); '''tx''' : temporary value 4 (integer); '''ty''' : temporary value 5 (integer);
20
'''i''' : index;
21
'''tu''' : temporary value 1 (integer); '''tv''' : temporary value 2 (integer);
22
'''tw''' : temporary value 3 (integer); '''tx''' : temporary value 4 (integer);
23
'''ty''' : temporary value 5 (integer);
2124
'''ps''' : pass (logical); '''ts''' : --not about gender-- test (logical) ; '''br''' : break (logical);
22
'''ea''' : error about "a"; '''eb''' : error about "b";
23
'''wa''' : warning about "a" ; '''wb''' : warning about "b" ;
25
'''ea''' : error code about "a" (integer); '''eb''' : error code about "b" (integer);
26
'''wa''' : warning code about "a" (integer); '''wb''' : warning code about "b" (integer);
27
'''ma''' : message about "a" (string); '''mb''' : message about "b" (string);
28
'''tm''' : temporary string, or transaction message (string); '''tn''' : temporary string 2 (string);
2429
'''ns''' : negative sign for multiplication and division (string);
25
{{{#!if this.as=a.toString(), this.bs=b.toString(), this.rs=0+0, this.ru=0+0, this.rb=0+0, this.ri=0+0, this.rp=0+0, this.i=0+0, this.tu=0, this.tv=1, this.tw=0, this.tx=0, this.ty=0, this.ea=0+0, this.eb=0+0, this.wa=0+0, this.wb=0+0, this.ps=false, this.ts=false, this.br=false, ns=""
30
31
##== 초기화 ==
32
값을 미리 정의하여 초기화합니다. 중간에 --장난으로-- 계산에 사용되는 변수에 값을 부여한 채로 include 하더라도 이를 무시합니다.
33
{{{#!if this.as=a.toString(), this.bs=b.toString(), this.rs=0+0, this.ru=0+0, this.rb=0+0, this.ri=0+0, this.rp=0+0, this.i=0+0, this.tu=0, this.tv=1, this.tw=0, this.tx=0, this.ty=0, this.ea=0+0, this.eb=0+0, this.wa=0+0, this.wb=0+0, this.ps=false, this.ts=false, this.br=false, this.ns="", this.ma="", this.mb="", this.tm=""
2634
}}}{{{#!if this.al=as.length, this.bl=bs.length, this.ad=as.indexOf("."), this.bd=bs.indexOf(".")
2735
}}}{{{#!if ad!=-1
2836
소수점이 발견되는 자리 번호가 ad이므로 ad+1번에 해당되는 자리부터 끝까지 표기합니다.
......
4149
{{{#!if this.bu=bs, bb="", bp=0+0, bd=bu.length
4250
}}}}}}
4351
44
입력한 소수점 아래에 입력한 값을 정리합니다. 이에 따라 ap, bp값도 다시 조정됩니다.
45
{{{#!if ap>9, ab.substr(ap-9,9)=="000000000"
46
{{{#!if ab=ab.substr(0,rp-9), ap=ap-9
47
}}}}}}
48
{{{#!if ap>4, ab.substr(ap-4,4)=="0000"
49
{{{#!if ab=ab.substr(0,ap-4), ap=ap-4
50
}}}}}}
51
{{{#!if ap>2, ab.substr(ap-2,2)=="00"
52
{{{#!if ab=ab.substr(0,ap-2), ap=ap-2
53
}}}}}}
54
{{{#!if ap>2, ab.substr(ap-2,2)=="00"
55
{{{#!if ab=ab.substr(0,ap-2), ap=ap-2
56
}}}}}}
57
{{{#!if ap>1, ab.substr(ap-1,1)=="0"
58
{{{#!if ab=ab.substr(0,ap-1), ap=ap-1
59
}}}}}}
60
{{{#!if bp>9, bb.substr(bp-9,9)=="000000000"
61
{{{#!if bb=bb.substr(0,rp-9), bp=bp-9
62
}}}}}}
63
{{{#!if bp>4, bb.substr(bp-4,4)=="0000"
64
{{{#!if bb=bb.substr(0,bp-4), bp=bp-4
65
}}}}}}
66
{{{#!if bp>2, bb.substr(bp-2,2)=="00"
67
{{{#!if bb=bb.substr(0,bp-2), bp=bp-2
68
}}}}}}
69
{{{#!if bp>2, bb.substr(bp-2,2)=="00"
70
{{{#!if bb=bb.substr(0,bp-2), bp=bp-2
71
}}}}}}
72
{{{#!if bp>1, bb.substr(bp-1,1)=="0"
73
{{{#!if bb=bb.substr(0,bp-1), bp=bp-1
74
}}}}}}
75
7652
##== 유효성 검사 ==
7753
the seed에서 지원되는 long(integer)가 unsigned였으면 1844경까지 가서 충분히 19자리로 놀 수 있었는데, signed long이므로 922경까지 가능한 공간에서 18자리로 잘라내기. 소수점 위 최대 18자리, 소수점 아래 최대 18자리
7854
{{{#!if ((au[0]!=45)&&(au.length>=19))||((au[0]==45)&&(au.length>=20))
......
9672
(반점(,)을 자동적으로 생략하고 들어가는 것은 나중에 생각하겠습니다.)
9773
{{{#!if false
9874
br와 ts 변수를 이용하여 순차적으로 검사를 진행합니다. 도중 문제가 있으면 (br를 true로 반환하고) 오류 코드를 내도록 만듭니다.
75
76
소수점 윗자릿수가 넘치면 오류코드 1번(오버플로)를 반환합니다.
9977
{{{#!if ts=((au[0]!=45)&&(au.length<=18))||((au[0]==45)&&(au.length<=19))
10078
}}}{{{#!if !ts&&!br
10179
{{{#!if br=true, ea=1
10280
}}}}}}
103
소수점 윗자릿수가 넘치면 오류코드 1번을 반환합니다.
81
82
소수점 2개 이상 입력하면 오류코드 5번을 반환합니다.
10483
{{{#!if ts&&!br
10584
{{{#!if ts=(as.indexOf(".")==as.lastIndexOf("."))
10685
}}}}}}{{{#!if !ts&&!bk
10786
{{{#!if br=true, ea=5
10887
}}}}}}
109
소수점을 2개 이상 입력하면 오류코드 5번을 반환합니다.
88
89
숫자가 아닌 이상 문구를 섞어넣을 경우 오류코드 6번을 반환합니다. (임시로 변수 tm과 tn를 가져옵니다.)
11090
{{{#!if ts&&!br
111
}}}
112
{{{#!if !test&&!break
113
{{{#!if break=true
114
}}}자릿수가 넘은 경우}}}{{{#!if test&&!break
115
자릿수가 넘지 않은 경우{{{#!if this.testtext=au
116
}}}{{{#!if rest=(au[0]==45), rest
117
{{{#!if testtext=au.substr(1, au.length-1)
118
}}}}}}{{{#!if testtext="1"+testtext, testmodifying=+testtext, testmodifying=testmodifying.toString()
119
}}}{{{#!if test=(testtext==testmodifying)
91
{{{#!if tm=au, tm[0]==45
92
{{{#!if tm=tm.substr(1, tm.length-1)
12093
}}}}}}
121
{{{#!if !test&&!break
122
{{{#!if break=true
123
}}}숫자가 아닌 이상한 문구를 섞어넣었을 경우}}}{{{#!if test&&!break
124
입력하신 문구에서 소수점 윗부분은 숫자가 맞는 경우{{{#!if ab=as.substr(ad+1, as.length-ad-1)
94
{{{#!if tm="1"+tm, tn=+tm, tn=tn.toString(), ts=(tm==tn)
12595
}}}}}}
96
{{{#!if !ts&&!br
97
{{{#!if br=true, ea=6
98
}}}}}}
99
100
{{{#!if ts&&!br
126101
}}}
102
}}}
127103
error code 05 번 ~ : 입력한 변수는 숫자로 읽을 수 없습니다.
128104
* 5번 : 반점(,)을 입력했다면 반점을 지우고 다시 입력하세요.
129105
130106
error code 03 번 : 0으로 나눌 수 없습니다.(아래쪽 참고)
131107
108
##== 2차 초기화 ==
109
입력한 소수점 아래에 입력한 값을 정리합니다. 이에 따라 ap, bp값도 다시 조정됩니다.
110
{{{#!if ap>9, ab.substr(ap-9,9)=="000000000"
111
{{{#!if ab=ab.substr(0,rp-9), ap=ap-9
112
}}}}}}
113
{{{#!if ap>4, ab.substr(ap-4,4)=="0000"
114
{{{#!if ab=ab.substr(0,ap-4), ap=ap-4
115
}}}}}}
116
{{{#!if ap>2, ab.substr(ap-2,2)=="00"
117
{{{#!if ab=ab.substr(0,ap-2), ap=ap-2
118
}}}}}}
119
{{{#!if ap>2, ab.substr(ap-2,2)=="00"
120
{{{#!if ab=ab.substr(0,ap-2), ap=ap-2
121
}}}}}}
122
{{{#!if ap>1, ab.substr(ap-1,1)=="0"
123
{{{#!if ab=ab.substr(0,ap-1), ap=ap-1
124
}}}}}}
125
{{{#!if bp>9, bb.substr(bp-9,9)=="000000000"
126
{{{#!if bb=bb.substr(0,rp-9), bp=bp-9
127
}}}}}}
128
{{{#!if bp>4, bb.substr(bp-4,4)=="0000"
129
{{{#!if bb=bb.substr(0,bp-4), bp=bp-4
130
}}}}}}
131
{{{#!if bp>2, bb.substr(bp-2,2)=="00"
132
{{{#!if bb=bb.substr(0,bp-2), bp=bp-2
133
}}}}}}
134
{{{#!if bp>2, bb.substr(bp-2,2)=="00"
135
{{{#!if bb=bb.substr(0,bp-2), bp=bp-2
136
}}}}}}
137
{{{#!if bp>1, bb.substr(bp-1,1)=="0"
138
{{{#!if bb=bb.substr(0,bp-1), bp=bp-1
139
}}}}}}
132140
133141
##== 덧셈, 뺄셈 ==
134142
덧셈과 뺄셈 계산과정을 적어봅니다.
......