[주의!] 문서의 이전 버전(에 수정)을 보고 있습니다. 최신 버전으로 이동
→ 원본에 대한 자세한 내용은 틀:구 계산기2 문서를 참고하십시오.
→ 떼어낸 계산기에 대한 자세한 내용은 틀:계산기/구버전 문서를 참고하십시오.

as : "a" value to string; bs : "b" value to string;
al : "a" string length (integer); bl : "b" string length (integer)
ad : "a" decimal point (integer); bd : "b" decimal point (integer);
au : gold "a" upper value (string→integer); bu : "b" upper value (string→integer);
ab : "a" below value (string→integer); bb : "b" below value (string→integer);
ap : "a" # of places of decimal (for addition or subtraction);
ac : a constant of "a" for division (integer);
bp : "b" # of places of decimal (for addition or subtraction);
bc : a constant of "b" for division (integer);
0.303과 0.0303은 다른 수이므로 자리수가 다름을 표시할 용도
ru : "result" upper value (integer→string); rb : "result" below value (integer→string);
rp : "result" # of places of decimal (integer);
rs : "result" suprerior value (integer→string); ri : "result" inferior value (integer→string);
i : index;
tu : temporary value 1 (integer); tv : temporary value 2 (integer);
tw : temporary value 3 (integer); tx : temporary value 4 (integer→string);
ty : temporary value 5 (integer); tz : temporary value 6 (integer);
pd : padding with zeros. (string)
ps : pass (logical); ts : not about gender test (logical) ; br : break (logical);
ea : error code about "a" (integer); eb : error code about "b" (integer);
wa : warning code about "a" (integer); wb : warning code about "b" (integer);
ma : message about "a" (string); mb : message about "b" (string);
tm : temporary string, or transaction message (string); tn : temporary string 2 (string);
ns : negative sign for multiplication and division (string);

값을 미리 정의하여 초기화합니다. 중간에 장난으로 계산에 사용되는 변수에 값을 부여한 채로 include 하더라도 이를 무시합니다.
소수점이 발견되는 자리 번호가 ad이므로 ad+1번에 해당되는 자리부터 끝까지 표기합니다.


the seed에서 지원되는 long(integer)가 unsigned였으면 1844경까지 가서 충분히 19자리로 놀 수 있었는데, signed long이므로 922경까지 가능한 공간에서 18자리로 잘라내기를 합니다. (소수점 위 최대 18자리, 소수점 아래 최대 18자리)

(반점(,)을 자동적으로 생략하고 들어가는 것은 나중에 생각하겠습니다.)



유효성 검사가 종료되었으면 ts와 br를 false로 초기화합니다.


입력한 소수점 아래에 입력한 값을 정리합니다. 이에 따라 ap, bp값도 다시 조정됩니다.











유효성 검사에 쓰인 tm과 tn 값을 빈 문자열 값으로 초기화합니다.


덧셈과 뺄셈 계산과정을 적어봅니다.




a와 b 모두 0이 아닌 경우에서 곱셈을 연산하는 과정입니다.


a와 b 모두 0이 아닌 경우에서 나눗셈을 연산하는 과정입니다.


연산이 끝났으면 표기된 숫자를 정리합니다.

먼저 ru를 (곱셈연산에서 정수값으로 나올 수 있으므로) 문자열로 바꿉니다.

18자리씩 끊어 표기하므로 소수점 위 19~36번째 자리에 해당하는 rs값이 (가령 곱셈에서, 곱한 값을 더한 결과가) 0일 경우 rs를 빈 문자열로 바꿉니다. 이 때 ru를 정수로 바꿔 ru 왼쪽에 있는 0들을 지운 다음, ru를 문자열로 바꿉니다.


계산과정에서 ru의 윗자리인 rs값이 0보다 클 경우, 1~18번째 자리인 ru에 빈 자리를 채우도록 ru의 왼쪽을 0으로 채웁니다.


i보다 소수점 아래부분을 더 써내려가야 하는 상황이 아닌(나눗셈에서 ts가 false인) 경우에서, 소수점 아래 19~36번째 자리에 해당하는 ri값이 0일 경우 ri를 빈 문자열로 바꿉니다.
이 때 ri와 rb가 모두 0일 경우 rb도 빈 문자열로 바꾸고 rp=0으로 둡니다.


ri가 빈 문자열이 아닐 (+ri가 0보다 클) 때 true를 주는 논리값으로 ps를 정의합니다.




!ts인 상황에서 ps가 true이면 rp를 ri의 길이로, 그렇지 않고 rb만 0이 아닌경우 rp를 rb의 길이로 정의합니다.




!ts이면서 ri가 빈 문자열이 아닐 경우 ri의 오른쪽부터 붙은 "0"들을 모두 지웁니다.


!ts이면서 이면서 ri가 빈 문자열일 경우, rb의 오른쪽에 붙은 "0"들을 모두 지웁니다,






ts인 경우 rb, ri의 오른쪽 부분을 정리하지 않고 rp를 39로 정의합니다.




rb 정리를 이것으로 종료합니다.

error
1 : 오버플로
5 : 이중 소수점 표기
6 : 소수점 윗부분 오류
7 : 소수점 아랫부분 오류

warning
1 : 소수점 아래 입력한 자릿수가 너무 많음.

sa : searching a; sb : searching b; sf : searching f;
rl : result string length to output; p : a point of string(s); ps : pass
ru는 계산결과에서 소수점 위 자리이므로, dot(.)이 나오지 않습니다.
변수를 입력하세요... (a, b, f를 입력하세요...)