Annotation of 43BSDTahoe/man/man1/bc.1, revision 1.1

1.1     ! root        1: .\"    @(#)bc.1        6.2 (Berkeley) 7/28/87
        !             2: .\"
        !             3: .TH BC 1 "July 28, 1987"
        !             4: .AT 3
        !             5: .SH NAME
        !             6: bc \- arbitrary-precision arithmetic language and calculator
        !             7: .SH SYNOPSIS
        !             8: .B bc
        !             9: [
        !            10: .B \-c
        !            11: ] [
        !            12: .B \-l
        !            13: ] [ file ... ]
        !            14: .SH DESCRIPTION
        !            15: .I Bc
        !            16: is an interactive processor for a language which resembles
        !            17: C but provides unlimited precision arithmetic.
        !            18: It takes input from any files given, then reads
        !            19: the standard input.
        !            20: The
        !            21: .B \-l
        !            22: argument stands for the name
        !            23: of an arbitrary precision math library.
        !            24: The syntax for 
        !            25: .I bc
        !            26: programs is as follows;
        !            27: L means letter a-z,
        !            28: E means expression, S means statement.
        !            29: .HP 6
        !            30: Comments
        !            31: .br
        !            32: are enclosed in /* and */.
        !            33: .HP 6
        !            34: Names
        !            35: .br
        !            36: simple variables: L
        !            37: .br
        !            38: array elements: L [ E ]
        !            39: .br
        !            40: The words `ibase', `obase', and `scale'
        !            41: .HP 6
        !            42: Other operands
        !            43: .br
        !            44: arbitrarily long numbers with optional sign and decimal point.
        !            45: .br
        !            46: ( E )
        !            47: .br
        !            48: sqrt ( E )
        !            49: .br
        !            50: length ( E )   number of significant decimal digits
        !            51: .br
        !            52: scale ( E )    number of digits right of decimal point
        !            53: .br
        !            54: L ( E , ... , E )
        !            55: .HP 6
        !            56: Operators
        !            57: .br
        !            58: +  \-  *  /  %  ^
        !            59: (% is remainder; ^ is power)
        !            60: .br
        !            61: ++   \-\-         (prefix and postfix; apply to names)
        !            62: .br
        !            63: ==  <=  >=  !=  <  >
        !            64: .br
        !            65: =  +=  \-=  *=  /=  %=  ^=
        !            66: .br
        !            67: .HP 6
        !            68: Statements
        !            69: .br
        !            70: E
        !            71: .br
        !            72: { S ; ... ; S }
        !            73: .br
        !            74: if ( E ) S
        !            75: .br
        !            76: while ( E ) S
        !            77: .br
        !            78: for ( E ; E ; E ) S
        !            79: .br
        !            80: null statement
        !            81: .br
        !            82: break
        !            83: .br
        !            84: quit
        !            85: .HP 6
        !            86: Function definitions
        !            87: .br
        !            88: define L ( L ,..., L ) {
        !            89: .br
        !            90:        auto L, ... , L
        !            91: .br
        !            92:        S; ... S
        !            93: .br
        !            94:        return ( E )
        !            95: .br
        !            96: }
        !            97: .HP 6
        !            98: Functions in 
        !            99: .B \-l
        !           100: math library
        !           101: .br
        !           102: s(x)   sine
        !           103: .br
        !           104: c(x)   cosine
        !           105: .br
        !           106: e(x)   exponential
        !           107: .br
        !           108: l(x)   log
        !           109: .br
        !           110: a(x)   arctangent
        !           111: .br
        !           112: j(n,x) Bessel function
        !           113: .PP
        !           114: .DT
        !           115: All function arguments are passed by value.
        !           116: .PP
        !           117: The value of a statement that is an expression is printed
        !           118: unless the main operator is an assignment.
        !           119: Either semicolons or newlines may separate statements.
        !           120: Assignment to
        !           121: .I scale
        !           122: influences the number of digits to be retained on arithmetic
        !           123: operations in the manner of
        !           124: .IR dc (1).
        !           125: Assignments to
        !           126: .I ibase
        !           127: or
        !           128: .I obase
        !           129: set the input and output number radix respectively.
        !           130: .PP
        !           131: The same letter may be used as an array, a function,
        !           132: and a simple variable simultaneously.
        !           133: All variables are global to the program.
        !           134: `Auto' variables are pushed down during function calls.
        !           135: When using arrays as function arguments
        !           136: or defining them as automatic variables
        !           137: empty square brackets must follow the array name.
        !           138: .PP
        !           139: For example
        !           140: .PP
        !           141: .nf
        !           142: scale = 20
        !           143: define e(x){
        !           144:        auto a, b, c, i, s
        !           145:        a = 1
        !           146:        b = 1
        !           147:        s = 1
        !           148:        for(i=1; 1==1; i++){
        !           149:                a = a*x
        !           150:                b = b*i
        !           151:                c = a/b
        !           152:                if(c == 0) return(s)
        !           153:                s = s+c
        !           154:        }
        !           155: }
        !           156: .PP
        !           157: .fi
        !           158: defines a function to compute an approximate value of
        !           159: the exponential function and
        !           160: .PP
        !           161: .nf
        !           162:        for(i=1; i<=10; i++) e(i)
        !           163: .fi
        !           164: .PP
        !           165: prints approximate values of the exponential function of
        !           166: the first ten integers.
        !           167: .PP
        !           168: .I Bc
        !           169: is actually a preprocessor for
        !           170: .IR dc (1),
        !           171: which it invokes automatically, unless the
        !           172: .B \-c
        !           173: (compile only)
        !           174: option is present.
        !           175: In this case the
        !           176: .I dc
        !           177: input is sent to the standard output instead.
        !           178: .SH FILES
        !           179: .ta \w'/usr/lib/lib.b 'u
        !           180: /usr/lib/lib.b mathematical library
        !           181: .br
        !           182: dc(1)  desk calculator proper
        !           183: .SH "SEE ALSO"
        !           184: dc(1)
        !           185: .br
        !           186: L. L. Cherry and R. Morris,
        !           187: .I
        !           188: BC \- An arbitrary precision desk-calculator language
        !           189: .SH BUGS
        !           190: No &&, \(or\|\(or, or ! operators.
        !           191: .br
        !           192: .I For
        !           193: statement must have all three E's.
        !           194: .br
        !           195: .I Quit
        !           196: is interpreted when read, not when executed.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.