?? dc.1
字號:
.TH DC 1 .SH NAMEdc \- desk calculator.SH SYNOPSIS.B dc[ file ].SH DESCRIPTION.I 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.I 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:.HP 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..HP 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..TP.BI s xThetop of the stack is popped and stored intoa register named.I x,where.I xmay be any character.Ifthe.B sis capitalized,.I xis treated as a stack and the value is pushed on it..TP.BI l xThevalue in register.I xis pushed on the stack.The register.I xis not altered.All registers start with zero value.If the.B lis capitalized,register.I xis treated as a stack and its top value is popped onto the main stack..TP.B dThetop value on the stack is duplicated..TP.B pThe top value on the stack is printed.The top value remains unchanged..B Pinterprets the top of the stack as an ascii string,removes it, and prints it..TP.B fAll values on the stack and in registers are printed..TP.B qexits the program.If executing a string, the recursion level ispopped by two.If.B qis capitalized,the top value on the stack is popped and the string execution level is poppedby that value..TP.B xtreats the top element of the stack as a character stringand executes it as a string of dc commands..TP.B Xreplaces the number on the top of the stack with its scale factor..TP.B "[ ... ]"puts the bracketed ascii string onto the top of the stack..HP 6.I "<x >x =x".brThetop two elements of the stack are popped and compared.Register.I xis executed if they obey the statedrelation..TP.B vreplaces 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..TP.B !interprets the rest of the line as a UNIX command..TP.B cAll values on the stack are popped..TP.B iThe top value on the stack is popped and used as thenumber radix for further input..B Ipushes the input base on the top of the stack..TP.B oThe top value on the stack is popped and used as thenumber radix for further output..TP.SM.B Opushes the output base on the top of the stack..TP.B kthe 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..TP.B zThe stack level is pushed onto the stack..TP.SM.B Zreplaces the number on the top of the stack with its length..TP.B ?A line of input is taken from the input source (usually the terminal)and executed..TP.B "; :"are used by .I bcfor array operations..PPAn example which prints the first ten values of n! is.nf.PP.in +3[la1+dsa*pla10>y]sy.br0sa1.brlyx.fi.SH "SEE ALSO"bc(1),which is a preprocessor for.I dcproviding infix notation and a C-like syntaxwhich implements functions and reasonable controlstructures for programs..SH DIAGNOSTICS`x is unimplemented' where x is an octal number..br`stack empty' for not enough elements on the stack to do what was asked..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.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -