home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / doc / bc / dc < prev   
Encoding:
Text File  |  1975-06-26  |  23.2 KB  |  696 lines

  1. .RP 75-1271-8 39199 39199-11
  2. .TL
  3. DC \- An Interactive Desk Calculator
  4. .AU "MH 2C-524" 3878
  5. Robert Morris
  6. .AU
  7. Lorinda Cherry
  8. .AI
  9. .MH
  10. .AB
  11. DC is an interactive desk calculator program implemented
  12. on the UNIX time-sharing system to do arbitrary-precision
  13. integer arithmetic.
  14. It has provision for manipulating scaled fixed-point numbers and
  15. for input and output in bases other than decimal.
  16. .PP
  17. The size of numbers that can be manipulated is limited
  18. only by available core storage.
  19. On typical implementations of UNIX, the size of numbers that
  20. can be handled varies from several hundred digits on the smallest
  21. systems to several thousand on the largest.
  22. .AE
  23. .PP
  24. .SH
  25. .ND
  26. .PP
  27. DC is an arbitrary precision arithmetic package implemented
  28. on the UNIX time-sharing system
  29. in the form of an interactive desk calculator.
  30. It works like a stacking calculator using reverse Polish notation.
  31. Ordinarily DC operates on decimal integers, but one may
  32. specify an input base, output base, and a number of fractional
  33. digits to be maintained.
  34. .PP
  35. A language called BC [1] has been developed which accepts
  36. programs written in the familiar style of higher-level
  37. programming languages and compiles output which is
  38. interpreted by DC.
  39. Some of the commands described below were designed
  40. for the compiler interface and are not easy for a human user
  41. to manipulate.
  42. .PP
  43. Numbers that are typed into DC are put on a push-down
  44. stack.
  45. DC commands work by taking the top number or two
  46. off the stack, performing the desired operation, and pushing the result
  47. on the stack.
  48. If an argument is given,
  49. input is taken from that file until its end,
  50. then from the standard input.
  51. .SH
  52. SYNOPTIC DESCRIPTION
  53. .PP
  54. Here we describe the DC commands that are intended
  55. for use by people.  The additional commands that are
  56. intended to be invoked by compiled output are
  57. described in the detailed description.
  58. .PP
  59. Any number of commands are permitted on a line.
  60. Blanks and new-line characters are ignored except within numbers
  61. and in places where a register name is expected.
  62. .PP
  63. The following constructions are recognized:
  64. .SH
  65. number
  66. .IP
  67. The value of the number is pushed onto the main stack.
  68. A number is an unbroken string of the digits 0-9
  69. and the capital letters A\-F which are treated as digits
  70. with values 10\-15 respectively.
  71. The number may be preceded by an underscore \*_ to input a
  72. negative number.
  73. Numbers may contain decimal points.
  74. .SH
  75. +  \-  *  %  ^
  76. .IP
  77. The
  78. top two values on the stack are added
  79. (\fB+\fP),
  80. subtracted
  81. (\fB\-\fP),
  82. multiplied (\fB*\fP),
  83. divided (\fB/\fP),
  84. remaindered (\fB%\fP),
  85. or exponentiated (^).
  86. The two entries are popped off the stack;
  87. the result is pushed on the stack in their place.
  88. The result of a division is an integer truncated toward zero.
  89. See the detailed description below for the treatment of
  90. numbers with decimal points.
  91. An exponent must not have any digits after the decimal point.
  92. .SH
  93. s\fIx\fP
  94. .IP
  95. The
  96. top of the main stack is popped and stored into
  97. a register named \fIx\fP, where \fIx\fP may be any character.
  98. If
  99. the
  100. .ft B
  101. s
  102. .ft
  103. is capitalized,
  104. .ft I
  105. x
  106. .ft
  107. is treated as a stack and the value is pushed onto it.
  108. Any character, even blank or new-line, is a valid register name.
  109. .SH
  110. l\fIx\fP
  111. .IP
  112. The
  113. value in register
  114. .ft I
  115. x
  116. .ft
  117. is pushed onto the stack.
  118. The register
  119. .ft I
  120. x
  121. .ft
  122. is not altered.
  123. If the
  124. .ft B
  125. l
  126. .ft
  127. is capitalized,
  128. register
  129. .ft I
  130. x
  131. .ft
  132. is treated as a stack and its top value is popped onto the main stack.
  133. .LP
  134. All registers start with empty value which is treated as a zero
  135. by the command \fBl\fP and is treated as an error by the command \fBL\fP.
  136. .SH
  137. .SH
  138. d
  139. .IP
  140. The
  141. top value on the stack is duplicated.
  142. .SH
  143. p
  144. .IP
  145. The top value on the stack is printed.
  146. The top value remains unchanged.
  147. .SH
  148. f
  149. .IP
  150. All values on the stack and in registers are printed.
  151. .SH
  152. x
  153. .IP
  154. treats the top element of the stack as a character string,
  155. removes it from the stack, and
  156. executes it as a string of DC commands.
  157. .SH
  158. [ ... ]
  159. .IP
  160. puts the bracketed character string onto the top of the stack.
  161. .SH
  162. q
  163. .IP
  164. exits the program.
  165. If executing a string, the recursion level is
  166. popped by two.
  167. If
  168. .ft B
  169. q
  170. .ft
  171. is capitalized,
  172. the top value on the stack is popped and the string execution level is popped
  173. by that value.
  174. .SH
  175. <\fIx\fP  >\fIx\fP  =\fIx\fP  !<\fIx\fP  !>\fIx\fP  !=\fIx\fP
  176. .IP
  177. The
  178. top two elements of the stack are popped and compared.
  179. Register
  180. .ft I
  181. x
  182. .ft
  183. is executed if they obey the stated
  184. relation.
  185. Exclamation point is negation.
  186. .SH
  187. v
  188. .IP
  189. replaces the top element on the stack by its square root.
  190. The square root of an integer is truncated to an integer.
  191. For the treatment of numbers with decimal points, see
  192. the detailed description below.
  193. .SH
  194. !
  195. .IP
  196. interprets the rest of the line as a UNIX command.
  197. Control returns to DC when the UNIX command terminates.
  198. .SH
  199. c
  200. .IP
  201. All values on the stack are popped; the stack becomes empty.
  202. .SH
  203. i
  204. .IP
  205. The top value on the stack is popped and used as the
  206. number radix for further input.
  207. If \fBi\fP is capitalized, the value of
  208. the input base is pushed onto the stack.
  209. No mechanism has been provided for the input of arbitrary
  210. numbers in bases less than 1 or greater than 16.
  211. .SH
  212. o
  213. .IP
  214. The top value on the stack is popped and used as the
  215. number radix for further output.
  216. If \fBo\fP is capitalized, the value of the output
  217. base is pushed onto the stack.
  218. .SH
  219. k
  220. .IP
  221. The top of the stack is popped, and that value is used as
  222. a scale factor
  223. that influences the number of decimal places
  224. that are maintained during multiplication, division, and exponentiation.
  225. The scale factor must be greater than or equal to zero and
  226. less than 100.
  227. If \fBk\fP is capitalized, the value of the scale factor
  228. is pushed onto the stack.
  229. .SH
  230. z
  231. .IP
  232. The value of the stack level is pushed onto the stack.
  233. .SH
  234. ?
  235. .IP
  236. A line of input is taken from the input source (usually the console)
  237. and executed.
  238. .SH
  239. DETAILED DESCRIPTION
  240. .SH
  241. Internal Representation of Numbers
  242. .PP
  243. Numbers are stored internally using a dynamic storage allocator.
  244. Numbers are kept in the form of a string
  245. of digits to the base 100 stored one digit per byte
  246. (centennial digits).
  247. The string is stored with the low-order digit at the
  248. beginning of the string.
  249. For example, the representation of 157
  250. is 57,1.
  251. After any arithmetic operation on a number, care is taken
  252. that all digits are in the range 0\-99 and that
  253. the number has no leading zeros.
  254. The number zero is represented by the empty string.
  255. .PP
  256. Negative numbers are represented in the 100's complement
  257. notation, which is analogous to two's complement notation for binary
  258. numbers.
  259. The high order digit of a negative number is always \-1
  260. and all other digits are in the range 0\-99.
  261. The digit preceding the high order \-1 digit is never a 99.
  262. The representation of \-157 is 43,98,\-1.
  263. We shall call this the canonical form of a number.
  264. The advantage of this kind of representation of negative
  265. numbers is ease of addition.  When addition is performed digit
  266. by digit, the result is formally correct.  The result need only
  267. be modified, if necessary, to put it into canonical form.
  268. .PP
  269. Because the largest valid digit is 99 and the byte can
  270. hold numbers twice that large, addition can be carried out
  271. and the handling of carries done later when
  272. that is convenient, as it sometimes is.
  273. .PP
  274. An additional byte is stored with each number beyond
  275. the high order digit to indicate the number of
  276. assumed decimal digits after the decimal point.  The representation
  277. of .001 is 1,\fI3\fP
  278. where the scale has been italicized to emphasize the fact that it
  279. is not the high order digit.
  280. The value of this extra byte is called the
  281. .ft B
  282. scale factor
  283. .ft
  284. of the number.
  285. .SH
  286. The Allocator
  287. .PP
  288. DC uses a dynamic string storage allocator
  289. for all of its internal storage.
  290. All reading and writing of numbers internally is done through
  291. the allocator.
  292. Associated with each string in the allocator is a four-word header containing pointers
  293. to the beginning of the string, the end of the string,
  294. the next place to write, and the next place to read.
  295. Communication between the allocator and DC
  296. is done via pointers to these headers.
  297. .PP
  298. The allocator initially has one large string on a list
  299. of free strings.  All headers except the one pointing
  300. to this string are on a list of free headers.
  301. Requests for strings are made by size.
  302. The size of the string actually supplied is the next higher
  303. power of 2.
  304. When a request for a string is made, the allocator
  305. first checks the free list to see if there is
  306. a string of the desired size.
  307. If none is found, the allocator finds the next larger free string and splits it repeatedly until
  308. it has a string of the right size.
  309. Left-over strings are put on the free list.
  310. If there are no larger strings,
  311. the allocator tries to coalesce smaller free strings into
  312. larger ones.
  313. Since all strings are the result
  314. of splitting large strings,
  315. each string has a neighbor that is next to it in core
  316. and, if free, can be combined with it to make a string twice as long.
  317. This is an implementation of the `buddy system' of allocation
  318. described in [2].
  319. .PP
  320. Failing to find a string of the proper length after coalescing,
  321. the allocator asks the system for more space.
  322. The amount of space on the system is the only limitation
  323. on the size and number of strings in DC.
  324. If at any time in the process of trying to allocate a string, the allocator runs out of
  325. headers, it also asks the system for more space.
  326. .PP
  327. There are routines in the allocator for reading, writing, copying, rewinding,
  328. forward-spacing, and backspacing strings.
  329. All string manipulation is done using these routines.
  330. .PP
  331. The reading and writing routines
  332. increment the read pointer or write pointer so that
  333. the characters of a string are read or written in
  334. succession by a series of read or write calls.
  335. The write pointer is interpreted as the end of the
  336. information-containing portion of a string and a call
  337. to read beyond that point returns an end-of-string indication.
  338. An attempt to write beyond the end of a string
  339. causes the allocator to
  340. allocate a larger space and then copy
  341. the old string into the larger block.
  342. .SH
  343. Internal Arithmetic
  344. .PP
  345. All arithmetic operations are done on integers.
  346. The operands (or operand) needed for the operation are popped
  347. from the main stack and their scale factors stripped off.
  348. Zeros are added or digits removed as necessary to get
  349. a properly scaled result from the internal arithmetic routine.
  350. For example, if the scale of the operands is different and decimal
  351. alignment is required, as it is for
  352. addition, zeros are appended to the operand with the smaller
  353. scale.
  354. After performing the required arithmetic operation,
  355. the proper scale factor is appended to the end of the number before
  356. it is pushed on the stack.
  357. .PP
  358. A register called \fBscale\fP plays a part
  359. in the results of most arithmetic operations.
  360. \fBscale\fP is the bound on the number of decimal places retained in
  361. arithmetic computations.
  362. \fBscale\fP may be set to the number on the top of the stack
  363. truncated to an integer with the \fBk\fP command.
  364. \fBK\fP may be used to push the value of \fBscale\fP on the stack.
  365. \fBscale\fP must be greater than or equal to 0 and less than 100.
  366. The descriptions of the individual arithmetic operations will
  367. include the exact effect of \fBscale\fP on the computations.
  368. .SH
  369. Addition and Subtraction
  370. .PP
  371. The scales of the two numbers are compared and trailing
  372. zeros are supplied to the number with the lower scale to give both
  373. numbers the same scale.  The number with the smaller scale is
  374. multiplied by 10 if the difference of the scales is odd.
  375. The scale of the result is then set to the larger of the scales
  376. of the two operands.
  377. .PP
  378. Subtraction is performed by negating the number
  379. to be subtracted and proceeding as in addition.
  380. .PP
  381. Finally, the addition is performed digit by digit from the
  382. low order end of the number.  The carries are propagated
  383. in the usual way.
  384. The resulting number is brought into canonical form, which may
  385. require stripping of leading zeros, or for negative numbers
  386. replacing the high-order configuration 99,\-1 by the digit \-1.
  387. In any case, digits which are not in the range 0\-99 must
  388. be brought into that range, propagating any carries or borrows
  389. that result.
  390. .SH
  391. Multiplication
  392. .PP
  393. The scales are removed from the two operands and saved.
  394. The operands are both made positive.
  395. Then multiplication is performed in
  396. a digit by digit manner that exactly mimics the hand method
  397. of multiplying.
  398. The first number is multiplied by each digit of the second
  399. number, beginning with its low order digit.  The intermediate
  400. products are accumulated into a partial sum which becomes the
  401. final product.
  402. The product is put into the canonical form and its sign is
  403. computed from the signs of the original operands.
  404. .PP
  405. The scale of the result is set equal to the sum
  406. of the scales of the two operands.
  407. If that scale is larger than the internal register
  408. .ft B
  409. scale
  410. .ft
  411. and also larger than both of the scales of the two operands,
  412. then the scale of the result is set equal to the largest
  413. of these three last quantities.
  414. .SH
  415. Division
  416. .PP
  417. The scales are removed from the two operands.
  418. Zeros are appended or digits removed from the dividend to make
  419. the scale of the result of the integer division equal to
  420. the internal quantity
  421. \fBscale\fP.
  422. The signs are removed and saved.
  423. .PP
  424. Division is performed much as it would be done by hand.
  425. The difference of the lengths of the two numbers
  426. is computed.
  427. If the divisor is longer than the dividend,
  428. zero is returned.
  429. Otherwise the top digit of the divisor is divided into the top
  430. two digits of the dividend.
  431. The result is used as the first (high-order) digit of the
  432. quotient.
  433. It may turn out be one unit too low, but if it is, the next
  434. trial quotient will be larger than 99 and this will be
  435. adjusted at the end of the process.
  436. The trial digit is multiplied by the divisor and the result subtracted
  437. from the dividend and the process is repeated to get
  438. additional quotient digits until the remaining
  439. dividend is smaller than the divisor.
  440. At the end, the digits of the quotient are put into
  441. the canonical form, with propagation of carry as needed.
  442. The sign is set from the sign of the operands.
  443. .SH
  444. Remainder
  445. .PP
  446. The division routine is called and division is performed
  447. exactly as described.  The quantity returned is the remains of the
  448. dividend at the end of the divide process.
  449. Since division truncates toward zero, remainders have the same
  450. sign as the dividend.
  451. The scale of the remainder is set to 
  452. the maximum of the scale of the dividend and
  453. the scale of the quotient plus the scale of the divisor.
  454. .SH
  455. Square Root
  456. .PP
  457. The scale is stripped from the operand.
  458. Zeros are added if necessary to make the
  459. integer result have a scale that is the larger of
  460. the internal quantity
  461. \fBscale\fP
  462. and the scale of the operand.
  463. .PP
  464. The method used to compute sqrt(y) is Newton's method
  465. with successive approximations by the rule
  466. .EQ
  467. x sub {n+1} = \(12 ( x sub n + y over x sub n )
  468. .EN
  469. The initial guess is found by taking the integer square root
  470. of the top two digits.
  471. .SH
  472. Exponentiation
  473. .PP
  474. Only exponents with zero scale factor are handled.  If the exponent is
  475. zero, then the result is 1.  If the exponent is negative, then
  476. it is made positive and the base is divided into one.  The scale
  477. of the base is removed.
  478. .PP
  479. The integer exponent is viewed as a binary number.
  480. The base is repeatedly squared and the result is
  481. obtained as a product of those powers of the base that
  482. correspond to the positions of the one-bits in the binary
  483. representation of the exponent.
  484. Enough digits of the result
  485. removed to make the scale of the result the same as if the
  486. indicated multiplication had been performed.
  487. .SH
  488. Input Conversion and Base
  489. .PP
  490. Numbers are converted to the internal representation as they are read
  491. in.
  492. The scale stored with a number is simply the number of fractional digits input.
  493. Negative numbers are indicated by preceding the number with a \fB\_\fP.
  494. The hexadecimal digits A\-F correspond to the numbers 10\-15 regardless of input base.
  495. The \fBi\fP command can be used to change the base of the input numbers.
  496. This command pops the stack, truncates the resulting number to an integer,
  497. and uses it as the input base for all further input.
  498. The input base is initialized to 10 but may, for example be changed to
  499. 8 or 16 to do octal or hexadecimal to decimal conversions.
  500. The command \fBI\fP will push the value of the input base on the stack.
  501. .SH
  502. Output Commands
  503. .PP
  504. The command \fBp\fP causes the top of the stack to be printed.
  505. It does not remove the top of the stack.
  506. All of the stack and internal registers can be output
  507. by typing the command \fBf\fP.
  508. The \fBo\fP command can be used to change the output base.
  509. This command uses the top of the stack, truncated to an integer as
  510. the base for all further output.
  511. The output base in initialized to 10.
  512. It will work correctly for any base.
  513. The command \fBO\fP pushes the value of the output base on the stack.
  514. .SH
  515. Output Format and Base
  516. .PP
  517. The input and output bases only affect
  518. the interpretation of numbers on input and output; they have no
  519. effect on arithmetic computations.
  520. Large numbers are output with 70 characters per line;
  521. a \\ indicates a continued line.
  522. All choices of input and output bases work correctly, although not all are
  523. useful.
  524. A particularly useful output base is 100000, which has the effect of
  525. grouping digits in fives.
  526. Bases of 8 and 16 can be used for decimal-octal or decimal-hexadecimal
  527. conversions.
  528. .SH
  529. Internal Registers
  530. .PP
  531. Numbers or strings may be stored in internal registers or loaded on the stack
  532. from registers with the commands \fBs\fP and \fBl\fP.
  533. The command \fBs\fIx\fR pops the top of the stack and
  534. stores the result in register \fBx\fP.
  535. \fIx\fP can be any character.
  536. \fBl\fIx\fR puts the contents of register \fBx\fP on the top of the stack.
  537. The \fBl\fP command has no effect on the contents of register \fIx\fP.
  538. The \fBs\fP command, however, is destructive.
  539. .SH
  540. Stack Commands
  541. .PP
  542. The command \fBc\fP clears the stack.
  543. The command \fBd\fP pushes a duplicate of the number on the top of the stack
  544. on the stack.
  545. The command \fBz\fP pushes the stack size on the stack.
  546. The command \fBX\fP replaces the number on the top of the stack
  547. with its scale factor.
  548. The command \fBZ\fP replaces the top of the stack
  549. with its length.
  550. .SH
  551. Subroutine Definitions and Calls
  552. .PP
  553. Enclosing a string in \fB[]\fP pushes the ascii string on the stack.
  554. The \fBq\fP command quits or in executing a string, pops the recursion levels by two.
  555. .SH
  556. Internal Registers \- Programming DC
  557. .PP
  558. The load and store
  559. commands together with \fB[]\fP to store strings, \fBx\fP to execute
  560. and the testing commands `<', `>', `=', `!<', `!>', `!=' can be used to program
  561. DC.
  562. The \fBx\fP command assumes the top of the stack is an string of DC commands
  563. and executes it.
  564. The testing commands compare the top two elements on the stack and if the relation holds, execute the register
  565. that follows the relation.
  566. For example, to print the numbers 0-9,
  567. .DS
  568. [lip1+  si  li10>a]sa
  569. 0si  lax
  570. .DE
  571. .SH
  572. Push-Down Registers and Arrays
  573. .PP
  574. These commands were designed for used by a compiler, not by
  575. people.
  576. They involve push-down registers and arrays.
  577. In addition to the stack that commands work on, DC can be thought
  578. of as having individual stacks for each register.
  579. These registers are operated on by the commands \fBS\fP and \fBL\fP.
  580. \fBS\fIx\fR pushes the top value of the main stack onto the stack for
  581. the register \fIx\fP.
  582. \fBL\fIx\fR pops the stack for register \fIx\fP and puts the result on the main
  583. stack.
  584. The commands \fBs\fP and \fBl\fP also work on registers but not as push-down
  585. stacks.
  586. \fBl\fP doesn't effect the top of the
  587. register stack, and \fBs\fP destroys what was there before.
  588. .PP
  589. The commands to work on arrays are \fB:\fP and \fB;\fP.
  590. \fB:\fIx\fR pops the stack and uses this value as an index into
  591. the array \fIx\fP.
  592. The next element on the stack is stored at this index in \fIx\fP.
  593. An index must be greater than or equal to 0 and
  594. less than 2048.
  595. \fB;\fIx\fR is the command to load the main stack from the array \fIx\fP.
  596. The value on the top of the stack is the index
  597. into the array \fIx\fP of the value to be loaded.
  598. .SH
  599. Miscellaneous Commands
  600. .PP
  601. The command \fB!\fP interprets the rest of the line as a UNIX command and passes
  602. it to UNIX to execute.
  603. One other compiler command is \fBQ\fP.
  604. This command uses the top of the stack as the number of levels of recursion to skip.
  605. .SH
  606. DESIGN CHOICES
  607. .PP
  608. The real reason for the use of a dynamic storage allocator was
  609. that a general purpose program could be (and in fact has been)
  610. used for a variety of other tasks.
  611. The allocator has some value for input and for compiling (i.e.
  612. the bracket [...] commands) where it cannot be known in advance
  613. how long a string will be.
  614. The result was that at a modest
  615. cost in execution time, all considerations of string allocation
  616. and sizes of strings were removed from the remainder of the program
  617. and debugging was made easier.  The allocation method
  618. used wastes approximately 25% of available space.
  619. .PP
  620. The choice of 100 as a base for internal arithmetic
  621. seemingly has no compelling advantage.  Yet the base cannot
  622. exceed 127 because of hardware limitations and at the cost
  623. of 5% in space, debugging was made a great deal easier and
  624. decimal output was made much faster.
  625. .PP
  626. The reason for a stack-type arithmetic design was
  627. to permit all DC commands from addition to subroutine execution
  628. to be implemented in essentially the same way.  The result
  629. was a considerable degree of logical separation of the final
  630. program into modules with very little communication between
  631. modules.
  632. .PP
  633. The rationale for the lack of interaction between the scale and the bases
  634. was to provide an understandable means of proceeding after
  635. a change of base or scale when numbers had already been entered.
  636. An earlier implementation which had global notions of
  637. scale and base did not work out well.
  638. If the value of
  639. .ft B
  640. scale
  641. .ft
  642. were to be interpreted in the current
  643. input or output base,
  644. then a change of base or scale in the midst of a
  645. computation would cause great confusion in the interpretation
  646. of the results.
  647. The current scheme has the advantage that the value of
  648. the input and output bases
  649. are only used for input and output, respectively, and they
  650. are ignored in all other operations.
  651. The value of
  652. scale
  653. is not used for any essential purpose by any part of the program
  654. and it is used only to prevent the number of
  655. decimal places resulting from the arithmetic operations from
  656. growing beyond all bounds.
  657. .PP
  658. The design rationale for the choices for the scales of
  659. the results of arithmetic were that in no case should
  660. any significant digits be thrown away if, on appearances, the
  661. user actually wanted them.  Thus, if the user wants
  662. to add the numbers 1.5 and 3.517, it seemed reasonable to give
  663. him the result 5.017 without requiring him to unnecessarily
  664. specify his rather obvious requirements for precision.
  665. .PP
  666. On the the other hand, multiplication and exponentiation produce
  667. results with many more digits than their operands and it
  668. seemed reasonable to give as a minimum the number of decimal
  669. places in the operands but not to give more than that
  670. number of digits
  671. unless the user asked for them by specifying a value for \fBscale\fP.
  672. Square root can be handled in just the same way as multiplication.
  673. The operation of division gives arbitrarily many decimal places
  674. and there is simply no way to guess how many places the user
  675. wants.
  676. In this case only, the user must
  677. specify a \fBscale\fP to get any decimal places at all.
  678. .PP
  679. The scale of remainder was chosen to make it possible
  680. to recreate the dividend from the quotient and remainder.
  681. This is easy to implement; no digits are thrown away.
  682. .SH
  683. References
  684. .IP[1]
  685. L. L. Cherry, R. Morris,
  686. .ft I
  687. BC \- An Arbitrary Precision Desk-Calculator Language,
  688. .ft
  689. .IP[2]
  690. K. C. Knowlton,
  691. .ft I
  692. A Fast Storage Allocator,
  693. .ft
  694. Comm. ACM \fB8\fP, pp. 623-625 (Oct. 1965)
  695. .LP
  696.