r6
| 1 | ##@미완성. 아마 작성된다면 수만 자는 나올 지도. 본 문서는 {{{틀}}} 네임스페이스의 편집 ACL에 맞게, 인증된 사용자이면 편집할 수 있습니다. |
|---|
r1
| 2 | ##@[include(틀:문서 가져옴/the seed, 위키=t, 문서명=틀:계산기, 버전=28, uuid=6259b383-901a-449b-b75c-5106a5c865ac)] |
|---|
r4
| 3 | ##테스트용 if문. 식="텍스트" 형식으로 입력하고 미리보기 가능. |
|---|
r5
| 4 | {{{#!if |
|---|
r3
| 5 | }}}{{{#!if b=(식==null)||(식==""), b |
|---|
r1
| 6 | ##b : blank |
|---|
r2
| 7 | 식을 입력하세요... (숫자와 {{{+}}}, {{{-}}}, {{{*}}}, {{{/}}}만 입력 가능합니다.)}}}{{{#!wiki style="display: none;" |
|---|
r4
| 8 | ##d : 자릿수, r : read |
|---|
| 9 | {{{#!if l=식.length, d=0, r=1 |
|---|
r2
| 10 | }}}}}}{{{#!if !b |
|---|
r3
| 11 | ##print와 for문이 없으면 이렇게 환장할 수 있는 길이가 나옵니다. |
|---|
| 12 | {{{#!wiki style="display: inline-flex;" |
|---|
| 13 | {{{#!wiki style="display: inline-block; width: .8em; height: 1.5em; padding: 0 0.1em; margin: 0 0.05em; background: #abcdef; text-align: center;" |
|---|
| 14 | {{{#!if d<l |
|---|
| 15 | {{{#!if 식[d]==48 |
|---|
r4
| 16 | {{{#!if this['r'+d]=1 |
|---|
| 17 | }}}0}}}{{{#!if 식[d]==49 |
|---|
| 18 | {{{#!if this['r'+d]=1 |
|---|
| 19 | }}}1}}}{{{#!if 식[d]==50 |
|---|
| 20 | {{{#!if this['r'+d]=1 |
|---|
| 21 | }}}2}}}{{{#!if 식[d]==51 |
|---|
| 22 | {{{#!if this['r'+d]=1 |
|---|
| 23 | }}}3}}}{{{#!if 식[d]==52 |
|---|
| 24 | {{{#!if this['r'+d]=1 |
|---|
| 25 | }}}4}}}{{{#!if 식[d]==53 |
|---|
| 26 | {{{#!if this['r'+d]=1 |
|---|
| 27 | }}}5}}}{{{#!if 식[d]==54 |
|---|
| 28 | {{{#!if this['r'+d]=1 |
|---|
| 29 | }}}6}}}{{{#!if 식[d]==55 |
|---|
| 30 | {{{#!if this['r'+d]=1 |
|---|
| 31 | }}}7}}}{{{#!if 식[d]==56 |
|---|
| 32 | {{{#!if this['r'+d]=1 |
|---|
| 33 | }}}8}}}{{{#!if 식[d]==57 |
|---|
| 34 | {{{#!if this['r'+d]=1 |
|---|
| 35 | }}}9}}}{{{#!if d=d+1 |
|---|
r7
| 36 | }}}}}}}}}{{{#!wiki style="display: inline-block; width: .8em; height: 1.5em; padding: 0 0.1em; margin: 0 0.05em; background: #abcdef; text-align: center" |
|---|
r3
| 37 | {{{#!if d<l |
|---|
| 38 | {{{#!if 식[d]==48 |
|---|
| 39 | 0}}}{{{#!if 식[d]==49 |
|---|
| 40 | 1}}}{{{#!if 식[d]==50 |
|---|
| 41 | 2}}}{{{#!if 식[d]==51 |
|---|
| 42 | 3}}}{{{#!if 식[d]==52 |
|---|
| 43 | 4}}}{{{#!if 식[d]==53 |
|---|
| 44 | 5}}}{{{#!if 식[d]==54 |
|---|
| 45 | 6}}}{{{#!if 식[d]==55 |
|---|
| 46 | 7}}}{{{#!if 식[d]==56 |
|---|
| 47 | 8}}}{{{#!if 식[d]==57 |
|---|
| 48 | 9}}}{{{#!if d=d+1 |
|---|
r8
| 49 | }}}}}}}}}}}}}}} |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | == 테스트 == |
|---|
| 53 | {{{#!if 식="3.141592" |
|---|
| 54 | 식="3.141592"}}}{{{#!if s1=false, s2=false, s3=false, j=1+0, i=0+0, k=1+0 |
|---|
| 55 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 56 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 57 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 58 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 59 | {{{#!if s2==false |
|---|
| 60 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 61 | }}}}}}{{{#!if s2==true |
|---|
| 62 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 63 | }}}{{{#!if k+=1 |
|---|
| 64 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 65 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 66 | }}}}}}{{{#!if (s1==true)&&!(this['d'+i]||식[i]==46)&&(s3==false) |
|---|
| 67 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 68 | }}}{{{#!if s3==true |
|---|
| 69 | {{{#!if s3=false |
|---|
| 70 | }}}}}} |
|---|
| 71 | }}}{{{#!if i+=1 |
|---|
| 72 | }}} |
|---|
| 73 | |
|---|
| 74 | {{{#!if v1==3 |
|---|
| 75 | v1==3}}} |
|---|
| 76 | ---- |
|---|
| 77 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 78 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 79 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 80 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 81 | {{{#!if s2==false |
|---|
| 82 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 83 | }}}}}}{{{#!if s2==true |
|---|
| 84 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 85 | }}}{{{#!if k+=1 |
|---|
| 86 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 87 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 88 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 89 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 90 | }}}{{{#!if s3==true |
|---|
| 91 | {{{#!if s3=false |
|---|
| 92 | }}}}}} |
|---|
| 93 | }}}{{{#!if i+=1 |
|---|
| 94 | }}} |
|---|
| 95 | {{{#!if v1==3 |
|---|
| 96 | v1==3}}} |
|---|
| 97 | ---- |
|---|
| 98 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 99 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 100 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 101 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 102 | {{{#!if s2==false |
|---|
| 103 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 104 | }}}}}}{{{#!if s2==true |
|---|
| 105 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 106 | }}}{{{#!if k+=1 |
|---|
| 107 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 108 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 109 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 110 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 111 | }}}{{{#!if s3==true |
|---|
| 112 | {{{#!if s3=false |
|---|
| 113 | }}}}}} |
|---|
| 114 | }}} |
|---|
| 115 | {{{#!if v1==3 |
|---|
| 116 | v1==3}}} |
|---|
| 117 | {{{#!if k==1 |
|---|
| 118 | k==1}}} |
|---|
| 119 | {{{#!if 10.0**(-k)==0.1 |
|---|
| 120 | 10**(-k)==10**(-1)==0.1}}} |
|---|
| 121 | {{{#!if i==2 |
|---|
| 122 | i==2}}} |
|---|
| 123 | {{{#!if +(식.substr(i,1))==1 |
|---|
| 124 | +(식.substr(i,1))==1}}} |
|---|
| 125 | |
|---|
| 126 | {{{#!if i+=1 |
|---|
| 127 | }}} |
|---|
| 128 | ---- |
|---|
| 129 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 130 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 131 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 132 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 133 | {{{#!if s2==false |
|---|
| 134 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 135 | }}}}}}{{{#!if s2==true |
|---|
| 136 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 137 | }}}{{{#!if k+=1 |
|---|
| 138 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 139 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 140 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 141 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 142 | }}}{{{#!if s3==true |
|---|
| 143 | {{{#!if s3=false |
|---|
| 144 | }}}}}} |
|---|
| 145 | }}}{{{#!if i+=1 |
|---|
| 146 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 147 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 148 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 149 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 150 | {{{#!if s2==false |
|---|
| 151 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 152 | }}}}}}{{{#!if s2==true |
|---|
| 153 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 154 | }}}{{{#!if k+=1 |
|---|
| 155 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 156 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 157 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 158 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 159 | }}}{{{#!if s3==true |
|---|
| 160 | {{{#!if s3=false |
|---|
| 161 | }}}}}} |
|---|
| 162 | }}}{{{#!if i+=1 |
|---|
| 163 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 164 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 165 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 166 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 167 | {{{#!if s2==false |
|---|
| 168 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 169 | }}}}}}{{{#!if s2==true |
|---|
| 170 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 171 | }}}{{{#!if k+=1 |
|---|
| 172 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 173 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 174 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 175 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 176 | }}}{{{#!if s3==true |
|---|
| 177 | {{{#!if s3=false |
|---|
| 178 | }}}}}} |
|---|
| 179 | }}}{{{#!if i+=1 |
|---|
| 180 | }}} |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | {{{#!if v1=="3.1415" |
|---|
| 184 | v1=="3.1415"}}} |
|---|
| 185 | {{{#!if v1=="3.14159" |
|---|
| 186 | v1=="3.14159"}}} |
|---|
| 187 | |
|---|
| 188 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 189 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 190 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 191 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 192 | {{{#!if s2==false |
|---|
| 193 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 194 | }}}}}}{{{#!if s2==true |
|---|
| 195 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 196 | }}}{{{#!if k+=1 |
|---|
| 197 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 198 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 199 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 200 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 201 | }}}{{{#!if s3==true |
|---|
| 202 | {{{#!if s3=false |
|---|
| 203 | }}}}}} |
|---|
| 204 | }}}{{{#!if i+=1 |
|---|
| 205 | }}} |
|---|
| 206 | |
|---|
| 207 | {{{#!if v1=="3.14159" |
|---|
| 208 | v1=="3.14159"}}} |
|---|
| 209 | |
|---|
| 210 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) |
|---|
| 211 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) |
|---|
| 212 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true |
|---|
| 213 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) |
|---|
| 214 | {{{#!if s2==false |
|---|
| 215 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true |
|---|
| 216 | }}}}}}{{{#!if s2==true |
|---|
| 217 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true |
|---|
| 218 | }}}{{{#!if k+=1 |
|---|
| 219 | }}}}}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) |
|---|
| 220 | {{{#!if s2=true, s3=true, k=1+0 |
|---|
| 221 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) |
|---|
| 222 | {{{#!if j+=1, s1=false, s2=false, s3=true |
|---|
| 223 | }}}{{{#!if s3==true |
|---|
| 224 | {{{#!if s3=false |
|---|
| 225 | }}}}}} |
|---|
| 226 | }}}{{{#!if i+=1 |
|---|
| 227 | }}} |
|---|
| 228 | {{{#!if v1=="3.141592" |
|---|
| 229 | v1=="3.141592"}}} |
|---|