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

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자리)

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



입력한 소수점 아래에 입력한 값을 정리합니다. 이에 따라 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으로 채웁니다.


소수점 아래 마지막 문자의 번호는 (.length - 1)입니다. 극단적으로 .10000 00000 00000 000 같은 것이 나올 수 있겠지만 18회 조사합니다.
substr(0,0)으로 하면 ""이 됩니다.

곱셈연산인 경우이거나 나눗셈에 나누어떨어지는 몫이 자릿수를 초과하지 않은(ts가 false인) 경우에서, ri가 빈 문자열이 아닐 때 true를 주는 논리값으로 ps를 정의합니다.

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를 입력하세요...)