home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / calc.info-27 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  28KB  |  524 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: Predicates,  Next: Computational Lisp Functions,  Prev: Stack Lisp Functions,  Up: Internals
  20. Predicates
  21. ..........
  22. The functions described here are predicates, that is, they return a
  23. true/false value where `nil' means false and anything else means true.
  24. These predicates are expanded by `defmath', for example, from `zerop'
  25. to `math-zerop'.  In many cases they correspond to native Lisp
  26. functions by the same name, but are extended to cover the full range of
  27. Calc data types.
  28.  - Function: zerop X
  29.      Returns true if X is numerically zero, in any of the Calc data
  30.      types.  (Note that for some types, such as error forms and
  31.      intervals, it never makes sense to return true.)  In `defmath',
  32.      the expression `(= x 0)' will automatically be converted to
  33.      `(math-zerop x)', and `(/= x 0)' will be converted to `(not
  34.      (math-zerop x))'.
  35.  - Function: negp X
  36.      Returns true if X is negative.  This accepts negative real numbers
  37.      of various types, negative HMS and date forms, and intervals in
  38.      which all included values are negative.  In `defmath', the
  39.      expression `(< x 0)' will automatically be converted to
  40.      `(math-negp x)', and `(>= x 0)' will be converted to `(not
  41.      (math-negp x))'.
  42.  - Function: posp X
  43.      Returns true if X is positive (and non-zero).  For complex
  44.      numbers, none of these three predicates will return true.
  45.  - Function: looks-negp X
  46.      Returns true if X is "negative-looking."  This returns true if X
  47.      is a negative number, or a formula with a leading minus sign such
  48.      as `-a/b'.  In other words, this is an object which can be made
  49.      simpler by calling `(- X)'.
  50.  - Function: integerp X
  51.      Returns true if X is an integer of any size.
  52.  - Function: fixnump X
  53.      Returns true if X is a native Lisp integer.
  54.  - Function: natnump X
  55.      Returns true if X is a nonnegative integer of any size.
  56.  - Function: fixnatnump X
  57.      Returns true if X is a nonnegative Lisp integer.
  58.  - Function: num-integerp X
  59.      Returns true if X is numerically an integer, i.e., either a true
  60.      integer or a float with no significant digits to the right of the
  61.      decimal point.
  62.  - Function: messy-integerp X
  63.      Returns true if X is numerically, but not literally, an integer.
  64.      A value is `num-integerp' if it is `integerp' or `messy-integerp'
  65.      (but it is never both at once).
  66.  - Function: num-natnump X
  67.      Returns true if X is numerically a nonnegative integer.
  68.  - Function: evenp X
  69.      Returns true if X is an even integer.
  70.  - Function: looks-evenp X
  71.      Returns true if X is an even integer, or a formula with a leading
  72.      multiplicative coefficient which is an even integer.
  73.  - Function: oddp X
  74.      Returns true if X is an odd integer.
  75.  - Function: ratp X
  76.      Returns true if X is a rational number, i.e., an integer or a
  77.      fraction.
  78.  - Function: realp X
  79.      Returns true if X is a real number, i.e., an integer, fraction, or
  80.      floating-point number.
  81.  - Function: anglep X
  82.      Returns true if X is a real number or HMS form.
  83.  - Function: floatp X
  84.      Returns true if X is a float, or a complex number, error form,
  85.      interval, date form, or modulo form in which at least one component
  86.      is a float.
  87.  - Function: complexp X
  88.      Returns true if X is a rectangular or polar complex number (but
  89.      not a real number).
  90.  - Function: rect-complexp X
  91.      Returns true if X is a rectangular complex number.
  92.  - Function: polar-complexp X
  93.      Returns true if X is a polar complex number.
  94.  - Function: numberp X
  95.      Returns true if X is a real number or a complex number.
  96.  - Function: scalarp X
  97.      Returns true if X is a real or complex number or an HMS form.
  98.  - Function: vectorp X
  99.      Returns true if X is a vector (this simply checks if its argument
  100.      is a list whose first element is the symbol `vec').
  101.  - Function: numvecp X
  102.      Returns true if X is a number or vector.
  103.  - Function: matrixp X
  104.      Returns true if X is a matrix, i.e., a vector of one or more
  105.      vectors, all of the same size.
  106.  - Function: square-matrixp X
  107.      Returns true if X is a square matrix.
  108.  - Function: objectp X
  109.      Returns true if X is any numeric Calc object, including real and
  110.      complex numbers, HMS forms, date forms, error forms, intervals, and
  111.      modulo forms.  (Note that error forms and intervals may include
  112.      formulas as their components; see `constp' below.)
  113.  - Function: objvecp X
  114.      Returns true if X is an object or a vector.  This also accepts
  115.      incomplete objects, but it rejects variables and formulas (except
  116.      as mentioned above for `objectp').
  117.  - Function: primp X
  118.      Returns true if X is a "primitive" or "atomic" Calc object, i.e.,
  119.      one whose components cannot be regarded as sub-formulas.  This
  120.      includes variables, and all `objectp' types except error forms and
  121.      intervals.
  122.  - Function: constp X
  123.      Returns true if X is constant, i.e., a real or complex number, HMS
  124.      form, date form, or error form, interval, or vector all of whose
  125.      components are `constp'.
  126.  - Function: lessp X Y
  127.      Returns true if X is numerically less than Y.  Returns false if X
  128.      is greater than or equal to Y, or if the order is undefined or
  129.      cannot be determined.  Generally speaking, this works by checking
  130.      whether `X - Y' is `negp'.  In `defmath', the expression `(< x y)'
  131.      will automatically be converted to `(lessp x y)'; expressions
  132.      involving `>', `<=', and `>=' are similarly converted in terms of
  133.      `lessp'.
  134.  - Function: beforep X Y
  135.      Returns true if X comes before Y in a canonical ordering of Calc
  136.      objects.  If X and Y are both real numbers, this will be the same
  137.      as `lessp'.  But whereas `lessp' considers other types of objects
  138.      to be unordered, `beforep' puts any two objects into a definite,
  139.      consistent order.  The `beforep' function is used by the `V S'
  140.      vector-sorting command, and also by `a s' to put the terms of a
  141.      product into canonical order: This allows `x y + y x' to be
  142.      simplified easily to `2 x y'.
  143.  - Function: equal X Y
  144.      This is the standard Lisp `equal' predicate; it returns true if X
  145.      and Y are structurally identical.  This is the usual way to
  146.      compare numbers for equality, but note that `equal' will treat 0
  147.      and 0.0 as different.
  148.  - Function: math-equal X Y
  149.      Returns true if X and Y are numerically equal, either because they
  150.      are `equal', or because their difference is `zerop'.  In
  151.      `defmath', the expression `(= x y)' will automatically be
  152.      converted to `(math-equal x y)'.
  153.  - Function: equal-int X N
  154.      Returns true if X and N are numerically equal, where N is a fixnum
  155.      which is not a multiple of 10.  This will automatically be used by
  156.      `defmath' in place of the more general `math-equal' whenever
  157.      possible.
  158.  - Function: nearly-equal X Y
  159.      Returns true if X and Y, as floating-point numbers, are equal
  160.      except possibly in the last decimal place.  For example, 314.159
  161.      and 314.166 are considered nearly equal if the current precision
  162.      is 6 (since they differ by 7 units), but not if the current
  163.      precision is 7 (since they differ by 70 units).  Mos