| r354 vs r355 | ||
|---|---|---|
| ... | ... | |
| 1561 | 1561 | 몫으로 기록할 숫자의 첫번째 자리를 구했다면, 그 다음 자리의 숫자를 찾기 위해 (변수 tn으로 만들 수 있는 여분의 1자리 +) 18자리 + 18자리 숫자를 18자리+18자리 숫자로 나누는 계산을 합니다. tn이 9가 될 경우 9로 시작하는 19자리 숫자를 long integer로 모두 표현할 수 없으므로 10**18 자리부터 먼저 계산합니다. 10**18의 1번째 숫자의 몫을 구한 다음 나머지를 18자리 숫자에 더하는 과정(part 1)을 거친 다음 그 18자리에서 몫을 구하는 과정(part 2)을 거칩니다. |
| 1562 | 1562 | |
| 1563 | 1563 | au와 ab를 정수로 다시 바꾸고 tz를 0으로 초기화합니다. 그리고 tn이 빈 문자열이 아니라면 (앞에 au에서 한 자리 수를 떼온 것이므로) tn에 0을 더하여 19자리로 만들고 몫을 구합니다. |
| 1564 | {{{#!if au=+au, ab=+ab, tz=0, tn!="" | |
| 1564 | {{{#!if au=+au, ab=+ab, tz=0, !br&&(tn!="") | |
| 1565 | 1565 | tn을 19자리 정수로 바꿉니다. |
| 1566 | 1566 | {{{#!if tn+=pd, tn=+tn |
| 1567 | 1567 | }}} |
| ... | ... | |
| 1621 | 1621 | }}}}}} |
| 1622 | 1622 | ##i=2 |
| 1623 | 1623 | 이후부터 과정은 동일합니다. 많아야 소수점 위 36자리, 소수점 아래 36자리 모두를 쓰면 72개이므로 총 72회(for i=0 to i=71)를 진행합니다. |
| 1624 | {{{#!if au=+au, ab=+ab, | |
| 1625 | {{{#!if tn+=pd, tn=+tn, tz=tn/bu, tx=bu*tz, ty=bb*tz | |
| 1626 | }}}{{{#!if ty=ty.toString(), ty.length==19 | |
| 1627 | ||
| 1624 | {{{#!if au=+au, ab=+ab, !br&&(tn!="") | |
| 1625 | {{{#!if tn+=pd, tn=+tn, tz=tn/bu, tx=bu*tz, ty=bb*tz, ty=ty.toString(), ps=(ty.length==19), tx=ps?tx+(+ty.substr(0,1)):tx, ty=ps?ty=ty.substr(1):ty, ty=+ty | |
| 1626 | }}}{{{#!if (tx>tn)||((tx==tn)&&(ty>0)) | |
| 1627 | {{{#!if tz=(tz==0):0:tz-1, tx=bu*tz, ty=bb*tz, ty=ty.toString(), ps=(ty.length==19), tx=ps?tx+(+ty.substr(0,1)):tx, ty=ps?ty=ty.substr(1):ty, ty=+ty | |
| 1628 | 1628 | }}}}}} |
| 1629 | {{{#!if ty=+ty, (tx>tn)||((tx==tn)&&(ty>0)) | |
| 1630 | {{{#!if tz-=1, tx=bu*tz, ty=bb*tz | |
| 1631 | }}}{{{#!if ty=ty.toString(), ty.length==19 | |
| 1632 | {{{#!if tx+=+(ty.substr(0,1)), ty=ty.substr(1,18) | |
| 1633 | }}}}}}{{{#!if ty=+ty | |
| 1634 | }}}}}} | |
| 1635 | 1629 | {{{#!if ty>ab |
| 1636 | 1630 | {{{#!if tn-=1, ab+=+("1"+pd) |
| 1637 | 1631 | }}}}}}{{{#!if au+=(tn-tx), ab-=ty, tn="" |
| 1632 | }}}}}}{{{#!if !br | |
| 1633 | {{{#!if tw=au/bu, tx=bu*tw, ty=bb*tw, ty=ty.toString(), ps=(ty.length==19), tx=ps?tx+(+ty.substr(0,1)):tx, ty=ps?ty=ty.substr(1):ty, ty=+ty, (tx>au)||((tx==au)&&(ty>ab)) | |
| 1634 | {{{#!if tw-=1, tx=bu*tw, ty=bb*tw, ty=ty.toString(), ps=(ty.length==19), tx=ps?tx+(+ty.substr(0,1)):tx, ty=ps?ty=ty.substr(1):ty, ty=+ty, | |
| 1638 | 1635 | }}}}}} |
| 1639 | {{{#!if !br | |
| 1640 | {{{#!if ps=false, (au<bu)||((au==bu)&&(ab<bb)) | |
| 1641 | {{{#!if ps=true, tw=0 | |
| 1642 | }}}}}} | |
| 1643 | {{{#!if !ps | |
| 1644 | {{{#!if tw=au/bu, tx=bu*tw, ty=bb*tw | |
| 1645 | }}}{{{#!if ty=ty.toString(), ty.length==19 | |
| 1646 | {{{#!if tx+=+(ty.substr(0,1)), ty=ty.substr(1,18) | |
| 1647 | }}}}}} | |
| 1648 | {{{#!if ty=+ty, (tx>au)||((tx==au)&&(ty>ab)) | |
| 1649 | {{{#!if tw-=1, tx=bu*tw, ty=bb*tw | |
| 1650 | }}}{{{#!if ty=ty.toString(), ty.length==19 | |
| 1651 | {{{#!if tx+=+(ty.substr(0,1)), ty=ty.substr(1,18) | |
| 1652 | }}}}}}{{{#!if ty=+ty | |
| 1653 | }}}}}} | |
| 1654 | 1636 | {{{#!if ty>ab |
| 1655 | 1637 | {{{#!if au-=1, ab+=+("1"+pd) |
| 1656 | }}}}}}{{{#!if au-=tx, ab-=ty | |
| 1657 | ||
| 1658 | ||
| 1638 | }}}}}}{{{#!if au-=tx, ab-=ty, tw+=tz, tw=tw.toString(), tm+=tw | |
| 1659 | 1639 | }}} |
| 1660 | 1640 | {{{#!if (au==0)&&(ab==0) |
| 1661 | 1641 | {{{#!if br=true |
| 1662 | 1642 | }}}}}}}}} |
| 1663 | 1643 | {{{#!if !br |
| 1664 | {{{#!if au=au.toString(), ab=ab.toString() | |
| 1665 | ||
| 1666 | ||
| 1667 | ||
| 1668 | ||
| 1669 | ||
| 1670 | ||
| 1671 | ||
| 1644 | {{{#!if au=au.toString(), ab=ab.toString(), ps=(au.length==18), tn=ps?au.substr(0,1):"", au=ps?au.substr(1):(pd+au).substr(-17), ab=(ab.length<18)?(pd+ab).substr(-18):ab, au+=ab.substr(0,1), ab=ab.substr(1)+"0" | |
| 1672 | 1645 | }}}}}} |
| 1673 | 1646 | ##i=3 |
| 1674 | 1647 | {{{#!if au=+au, ab=+ab, tz=0, !br&&(tn!="") |
| ... | ... |