| r74 vs r75 | ||
|---|---|---|
| ... | ... | |
| 10 | 10 | '''ab''' : "a" below value (string→integer); '''bb''' : "b" below value (string→integer); |
| 11 | 11 | '''ap''' : "a" # of places of decimal (integer); '''bp''' : "b" # of places of decimal (integer); |
| 12 | 12 | 0.303과 0.0303은 다른 수이므로 자리수가 다름을 표시할 용도 |
| 13 | '''ru''' : "result" upper value (integer); '''rb''' : "result" below value (integer); '''rp''' : "result" # of places of decimal (integer) | |
| 13 | '''ru''' : "result" upper value (integer→string); '''rb''' : "result" below value (integer→string); '''rp''' : "result" # of places of decimal (integer) | |
| 14 | 14 | {{{#!if this.as=a.toString(), this.bs=b.toString(), this.ru=0+0, this.rb=0+0 |
| 15 | 15 | }}}{{{#!if this.al=as.length, this.bl=bs.length, this.ad=as.indexOf("."), this.bd=bs.indexOf(".") |
| 16 | 16 | }}}{{{#!if ad!=-1 |
| ... | ... | |
| 141 | 141 | }}}}}} |
| 142 | 142 | }}} |
| 143 | 143 | |
| 144 | a가 음수인 경우 소수점 아래 값은 순 숫자만 표기된 상태이 | |
| 144 | a가 음수인 경우 소수점 아래 값은 순 숫자만 표기된 상태이므로 양수 취급으로 되지 않게 소수점 아래 값에 음수 표기를 남깁니다. | |
| 145 | 145 | {{{#!if as[0]==45 |
| 146 | 146 | {{{#!if ab="-"+ab |
| 147 | 147 | }}}}}} |
| ... | ... | |
| 163 | 163 | 문자열 길이를 rp로 정의합니다. |
| 164 | 164 | {{{#!if this.rp=rb.length |
| 165 | 165 | }}} |
| 166 | rb가 음수이면 | |
| 166 | rb가 음수이면 rp를 -1로 줄여 정의합니다. | |
| 167 | 167 | {{{#!if rb[0]==45 |
| 168 | {{{#!if r | |
| 169 | ||
| 168 | {{{#!if rp=rp-1 | |
| 170 | 169 | }}}}}} |
| 171 | 170 | |
| 172 | ||
| 171 | ru는 정수이므로 ru가 0보다 크면 곧 1 이상이며, 1 이상이면 양수+음수 꼴이 되더라도 소수점 아래 정리를 하면 됩니다. ru에서 1을 빌려오거나 ru에 1이 더해질 수도 있습니다. | |
| 173 | 172 | {{{#!if ru>0 |
| 174 | ru는 정수이므로 0보다 크면 곧 1 이상이며, 1 이상이면 양수+음수 꼴이 되더라도 소수점 아래 정리를 하면 됩니다. ru에서 1을 빌려오거나 ru에 1이 더해질 수도 있습니다. | |
| 175 | 173 | {{{#!if rb>0 |
| 176 | 174 | }}}}}} |
| 177 | 175 | {{{#!if ru==0 |
| ... | ... |