| r96 vs r97 | ||
|---|---|---|
| 1 | 1 | [[분류:냥]][Include(틀:상세 내용, 설명대상=원본, 문서명=틀\:계산기)] |
| 2 | 2 | == 2-2 == |
| 3 | 3 | ===# 디버그 #=== |
| 4 | {{{#!if a= ,b= ,f= | |
| 4 | {{{#!if a="111.111" ,this.b="111.111" ,f="+" | |
| 5 | 5 | }}} |
| 6 | 6 | {{{#!wiki style="display: none; display: inline;" |
| 7 | 7 | ##초기화 |
| ... | ... | |
| 18 | 18 | }}}{{{#!if this.al=as.length, this.bl=bs.length, this.ad=as.indexOf("."), this.bd=bs.indexOf(".") |
| 19 | 19 | }}}{{{#!if ad!=-1 |
| 20 | 20 | 소수점이 발견되는 자리 번호가 ad이므로 ad+1번에 해당되는 자리부터 끝까지 표기. |
| 21 | {{{#!if this.au=as.substr(0,ad), this.ab=as.substr(ad+1, al-ad-1), this.ap=ab.length | |
| 21 | {{{#!if this.au=as.substr(0, ad), this.ab=as.substr(ad+1, al-ad-1), this.ap=ab.length | |
| 22 | 22 | }}}{{{#!if (au=="")||(au=="-")||(au=="+") |
| 23 | 23 | .12345 식으로 또는 -.12345 식으로 기입할 경우 upper 값을 0으로 부여함. |
| 24 | 24 | {{{#!if au="0" |
| 25 | 25 | }}}}}}}}}{{{#!if ad==-1 |
| 26 | 26 | {{{#!if this.au=as, ab="", ap=0+0 |
| 27 | 27 | }}}}}}{{{#!if bd!=-1 |
| 28 | {{{#!if this.bu=bs.substr.(0,bd), this.bb=bs.substr(bd+1, bl-bd-1), this.bp=bb.length | |
| 28 | {{{#!if this.bu=bs.substr.(0, bd), this.bb=bs.substr(bd+1, bl-bd-1), this.bp=bb.length | |
| 29 | 29 | }}}{{{#!if (bu=="")||(bu=="-")||(bu=="+") |
| 30 | 30 | {{{#!if bu="0" |
| 31 | 31 | }}}}}}}}}{{{#!if bd==-1 |
| ... | ... | |
| 65 | 65 | {{{#!if f=="-" |
| 66 | 66 | {{{#!if ru=(+au)-(+bu) |
| 67 | 67 | }}}}}} |
| 68 | ||
| 68 | {{{#!if +au==111 | |
| 69 | +au==111}}} | |
| 70 | {{{#!if +bu==111 | |
| 71 | +bu==111}}} | |
| 72 | {{{#!if +ru==222 | |
| 73 | +ru==222}}} | |
| 69 | 74 | a와 b 모두가 정수이면 ad=a.indexOf("."), bd=b.indexOf(".") 모두 -1이고 ap==0, bp==0이 되며, 이런 경우에는 소수점 아래 자릿수를 검산할 필요가 없습니다. a와 b 중 소수점 아래 자릿수가 있는 수가 있을 때에만 소수점 윗자리의 계산값이 얼마가 나오느냐를 보면서 소수점 아래의 자릿수를 정리하는 과정이 의미가 있습니다. |
| 70 | 75 | {{{#!if (ap>0)||(bp>0) |
| 71 | 76 | 만약 소수점 아래를 계산한다면 자릿수를 똑같이 맞춰야 의미가 있으므로, 자릿수가 다른 경우 자릿수가 같게 만드는 과정을 먼저 거칩니다. |
| ... | ... |