home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / calc.info-11 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  51KB  |  869 lines

  1. This is Info file calc.info, produced by Makeinfo-1.55 from the input
  2. file calc.texinfo.
  3.    This file documents Calc, the GNU Emacs calculator.
  4.    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the section entitled "GNU General Public License" is included
  11. exactly as in the original, and provided that the entire resulting
  12. derived work is distributed under the terms of a permission notice
  13. identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the section entitled "GNU General Public License"
  17. may be included in a translation approved by the author instead of in
  18. the original English.
  19. File: calc.info,  Node: Functions for Declarations,  Prev: Kinds of Declarations,  Up: Declarations
  20. Functions for Declarations
  21. --------------------------
  22. Calc has a set of functions for accessing the current declarations in a
  23. convenient manner.  These functions return 1 if the argument can be
  24. shown to have the specified property, or 0 if the argument can be shown
  25. *not* to have that property; otherwise they are left unevaluated.
  26. These functions are suitable for use with rewrite rules (*note
  27. Conditional Rewrite Rules::.) or programming constructs (*note
  28. Conditionals in Macros::.).  They can be entered only using algebraic
  29. notation.  *Note Logical Operations::, for functions that perform other
  30. tests not related to declarations.
  31.    For example, `dint(17)' returns 1 because 17 is an integer, as do
  32. `dint(n)' and `dint(2 n - 3)' if `n' has been declared `int', but
  33. `dint(2.5)' and `dint(n + 0.5)' return 0.  Calc consults knowledge of
  34. its own built-in functions as well as your own declarations:
  35. `dint(floor(x))' returns 1.
  36.    The `dint' function checks if its argument is an integer.  The
  37. `dnatnum' function checks if its argument is a natural number, i.e., a
  38. nonnegative integer.  The `dnumint' function checks if its argument is
  39. numerically an integer, i.e., either an integer or an integer-valued
  40. float.  Note that these and the other data type functions also accept
  41. vectors or matrices composed of suitable elements, and that real
  42. infinities `inf' and `-inf' are considered to be integers for the
  43. purposes of these functions.
  44.    The `drat' function checks if its argument is rational, i.e., an
  45. integer or fraction.  Infinities count as rational, but intervals and
  46. error forms do not.
  47.    The `dreal' function checks if its argument is real.  This includes
  48. integers, fractions, floats, real error forms, and intervals.
  49.    The `dimag' function checks if its argument is imaginary, i.e., is
  50. mathematically equal to a real number times `i'.
  51.    The `dpos' function checks for positive (but nonzero) reals.  The
  52. `dneg' function checks for negative reals.  The `dnonneg' function
  53. checks for nonnegative reals, i.e., reals greater than or equal to
  54. zero.  Note that the `a s' command can simplify an expression like `x >
  55. 0' to 1 or 0 using `dpos', and that `a s' is effectively applied to all
  56. conditions in rewrite rules, so the actual functions `dpos', `dneg',
  57. and `dnonneg' are rarely necessary.
  58.    The `dnonzero' function checks that its argument is nonzero.  This
  59. includes all nonzero real or complex numbers, all intervals that do not
  60. include zero, all nonzero modulo forms, vectors all of whose elements
  61. are nonzero, and variables or formulas whose values can be deduced to
  62. be nonzero.  It does not include error forms, since they represent
  63. values which could be anything including zero.  (This is also the set
  64. of objects considered "true" in conditional contexts.)
  65.    The `deven' function returns 1 if its argument is known to be an
  66. even integer (or integer-valued float); it returns 0 if its argument is
  67. known not to be even (because it is known to be odd or a non-integer).
  68. The `a s' command uses this to simplify a test of the form `x % 2 = 0'.
  69. There is also an analogous `dodd' function.
  70.    The `drange' function returns a set (an interval or a vector of
  71. intervals and/or numbers; *note Set Operations::.) that describes the
  72. set of possible values of its argument.  If the argument is a variable
  73. or a function with a declaration, the range is copied from the
  74. declaration.  Otherwise, the possible signs of the expression are
  75. determined using a method similar to `dpos', etc., and a suitable set
  76. like `[0 .. inf]' is returned.  If the expression is not provably real,
  77. the `drange' function remains unevaluated.
  78.    The `dscalar' function returns 1 if its argument is provably scalar,
  79. or 0 if its argument is provably non-scalar.  It is left unevaluated if
  80. this cannot be determined.  (If matrix mode or scalar mode are in
  81. effect, this function returns 1 or 0, respectively, if it has no other
  82. information.)  When Calc interprets a condition (say, in a rewrite
  83. rule) it considers an unevaluated formula to be "false."  Thus,
  84. `dscalar(a)' is "true" only if `a' is provably scalar, and
  85. `!dscalar(a)' is "true" only if `a' is provably non-scalar; both are
  86. "false" if there is insufficient information to tell.
  87. File: calc.info,  Node: Display Modes,  Next: Language Modes,  Prev: Declarations,  Up: Mode Settings
  88. Display Modes
  89. =============
  90. The commands in this section are two-key sequences beginning with the
  91. `d' prefix.  The `d l' (`calc-line-numbering') and `d b'
  92. (`calc-line-breaking') commands are described elsewhere; *note Stack
  93. Basics::. and *note Normal Language Modes::., respectively.  Display
  94. formats for vectors and matrices are also covered elsewhere; *note
  95. Vector and Matrix Formats::..
  96.    One thing all display modes have in common is their treatment of the
  97. `H' prefix.  This prefix causes any mode command that would normally
  98. refresh the stack to leave the stack display alone.  The word "Dirty"
  99. will appear in the mode line when Calc thinks the stack display may not
  100. reflect the latest mode settings.
  101.    The `d RET' (`calc-refresh-top') command reformats the top stack
  102. entry according to all the current modes.  Positive prefix arguments
  103. reformat the top N entries; negative prefix arguments reformat the
  104. specified entry, and a prefix of zero is equivalent to `d SPC'
  105. (`calc-refresh'), which reformats the entire stack.  For example, `H d
  106. s M-2 d RET' changes to scientific notation but reformats only the top
  107. two stack entries in the new mode.
  108.    The `I' prefix has another effect on the display modes.  The mode is
  109. set only temporarily; the top stack entry is reformatted according to
  110. that mode, then the original mode setting is restored.  In other words,
  111. `I d s' is equivalent to `H d s d RET H d (OLD MODE)'.
  112. * Menu:
  113. * Radix Modes::
  114. * Grouping Digits::
  115. * Float Formats::
  116. * Complex Formats::
  117. * Fraction Formats::
  118. * HMS Formats::
  119. * Date Formats::
  120. * Truncating the Stack::
  121. * Justification::
  122. * Labels::
  123. File: calc.info,  Node: Radix Modes,  Next: Grouping Digits,  Prev: Display Modes,  Up: Display Modes
  124. Radix Modes
  125. -----------
  126. Calc normally displays numbers in decimal ("base-10" or "radix-10")
  127. notation.  Calc can actually display in any radix from two (binary) to
  128. 36.  When the radix is above 10, the letters `A' to `Z' are used as
  129. digits.  When entering such a number, letter keys are interpreted as
  130. potential digits rather than terminating numeric entry mode.
  131.    The key sequences `d 2', `d 8', `d 6', and `d 0' select binary,
  132. octal, hexadecimal, and decimal as the current display radix,
  133. respectively.  Numbers can always be entered in any radix, though the
  134. current radix is used as a default if you press `#' without any initial
  135. digits.  A number entered without a `#' is *always* interpreted as
  136. decimal.
  137.    To set the radix generally, use `d r' (`calc-radix') and enter an
  138. integer from 2 to 36.  You can specify the radix as a numeric prefix
  139. argument; otherwise you will be prompted for it.
  140.    Integers normally are displayed with however many digits are
  141. necessary to represent the integer and no more.  The `d z'
  142. (`calc-leadi