📄 dc.1
字号:
.th DC I 2/8/75.sh NAMEdc \*- desk calculator.sh SYNOPSIS.bd dc[ file ].sh DESCRIPTION.it Dcis an arbitrary precision arithmetic package.Ordinarily it operates on decimal integers,but one may specify an input base, output base,and a number of fractional digits to be maintained.The overall structure of.it dcisa stacking (reverse Polish) calculator.If an argument is given,input is taken from that file until its end,then from the standard input.The following constructions are recognized:.s3.lp +6 6number.brThe value of the number is pushed on the stack.A number is an unbroken string of the digits 0-9.It may be preceded by an underscore \*_ to input anegative number.Numbers may contain decimal points..s3.lp +6 6+ \- * % ^.brThetop two values on the stack are added(+),subtracted(\*-),multiplied (*),divided (/),remaindered (%),or exponentiated (^).The two entries are popped off the stack;the result is pushed on the stack in their place.Any fractional part of an exponent is ignored..s3.lp +6 6\fBs\fIx\fR Thetop of the stack is popped and stored intoa register named.it x,where.it xmay be any character.Ifthe.bd sis capitalized,.it xis treated as a stack and the value is pushed on it..s3.lp +6 6\fBl\fIx\fR Thevalue in register.it xis pushed on the stack.The register.it xis not altered.All registers start with zero value.If the.bd lis capitalized,register.it xis treated as a stack and its top value is popped onto the main stack..s3.lp +6 6\fBd\fR Thetop value on the stack is duplicated..s3.lp +6 6\fBp\fR The top value on the stack is printed.The top value remains unchanged..s3.lp +6 6\fBf\fR All values on the stack and in registers are printed..s3.lp +6 6\fBq\fR exits the program.If executing a string, the recursion level ispopped by two.If.bd qis capitalized,the top value on the stack is popped and the string execution level is poppedby that value..s3.lp +6 6\fBx\fR treats the top element of the stack as a character stringand executes it as a string of dc commands..s3.lp +6 6\fB[ ... ]\fR puts the bracketed ascii string onto the top of the stack..s3.lp +6 6\fI<x >x =x\fR.brThetop two elements of the stack are popped and compared.Register.it xis executed if they obey the statedrelation..s3.lp +6 6\fBv\fR replaces the top element on the stack by its square root.Any existing fractional part of the argument is takeninto account, but otherwise the scale factor is ignored..s3.lp +6 6\fB!\fR interprets the rest of the line as a UNIX command..s3.lp +6 6\fBc\fR All values on the stack are popped..s3.lp +6 6\fBi\fR The top value on the stack is popped and used as thenumber radix for further input..s3.lp +6 6\fBo\fR The top value on the stack is popped and used as thenumber radix for further output..s3.lp +6 6\fBk\fR the top of the stack is popped, and that value is used asa non-negative scale factor:the appropriate number of placesare printed on output,and maintained during multiplication, division, and exponentiation.The interaction of scale factor,input base, and output base will be reasonable if all are changedtogether..s3.lp +6 6\fBz\fR The stack level is pushed onto the stack..s3.lp +6 6\fB?\fR A line of input is taken from the input source (usually the console)and executed..s3.i0An example which prints the first ten values of n! is.nf.s3.in +3.bd "[la1+dsa*pla10>y]sy".bd "0sa1".bd lyx.i0.fi.sh "SEE ALSO"bc (I),which is a preprocessor for.it dcproviding infix notation and a C-like syntaxwhich implements functions and reasonable controlstructures for programs..sh DIAGNOSTICS(x) ? for unrecognized character x..br(x) ? for not enough elements on the stack to do what was asked by command x..br`Out of space' when the free list is exhausted (too many digits)..br`Out of headers' for too many numbers being kept around..br`Out of pushdown' for too many items on the stack..br`Nesting Depth' for too many levels of nested execution..sh BUGS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -