]> git.eshelyaron.com Git - emacs.git/commitdiff
(Basic Arithmetic, Customizing Calc): Mention
authorJay Belanger <jay.p.belanger@gmail.com>
Wed, 20 Jun 2007 15:20:53 +0000 (15:20 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Wed, 20 Jun 2007 15:20:53 +0000 (15:20 +0000)
`calc-multiplication-has-precedence'.

lisp/ChangeLog
man/ChangeLog
man/calc.texi

index 02745e8149af3489cc66e7d062b6ffe9b66f19fa..d446ef93926285cc3e294feb6da00183806f40a9 100644 (file)
 
        * progmodes/vera-mode.el: New file.
 
+2007-06-19  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc.el (calc-multiplication-has-precendence):
+       New variable.
+       (math-standard-ops,math-standard-ops-p,math-expr-ops):
+       New functions.
+       (math-expr-opers): Define using math-standard-ops rather than
+       math-standard-opers.
+       * calc/calc-aent.el (calc-do-calc-eval): Let math-expr-opers
+       equal the function math-standard-ops rather than the variable
+       math-standard-opers.
+       (calc-algebraic-entry): Let math-expr-opers equal
+       math-standard-ops or math-expr-ops, as appropriate.
+       (math-expr-read-level,math-read-factor): Let math-expr-opers
+       equal math-expr-ops.
+       * calc/calc-embed.el (calc-embedded-finish-edit):
+       Let math-expr-opers equal the function math-standard-ops
+       rather than the variable math-standard-opers.
+       * calc/calc-ext.el (math-read-plain-expr)
+       (math-format-flat-expr-fancy): Let math-expr-opers equal the
+       function math-standard-ops rather than the variable
+       math-standard-opers.
+       * calc/calc-lang.el (calc-set-language,math-read-big-rec):
+       Let math-expr-opers equal the function math-standard-ops rather
+       than the variable math-standard-opers.
+       * calc/calc-prog.el (calc-read-parse-table): Let math-expr-opers
+       equal the function math-standard-ops rather than the variable
+       math-standard-opers.
+       * calc/calc-yank.el (calc-finish-stack-edit): Let math-expr-opers
+       equal the function math-standard-ops rather than the variable
+       math-standard-opers.
+       * calc/calccomp.el (math-compose-expr): Let math-expr-opers equal
+       math-expr-ops.
+
 2007-06-19  Ivan Kanis  <apple@kanis.eu>
 
        * vc-hg.el: New file.
index 1283f03c14b31c720ed40819498532087d30ba51..8de0d9807f26f2d5742baeac25c1444b356b7b8b 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-19  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.texi (Basic Arithmetic, Customizing Calc): Mention
+       the variable `calc-multiplication-has-precedence'.
+
 2007-06-19  Carsten Dominik  <dominik@science.uva.nl>
 
        * org.texi (Tag): Section swapped with node Timestamps.
index ecf85a450bdb1a8ceaf78223da47a5eb938a1bf7..01c153a230a08703d097f0e1d6f0e97782e43cf4 100644 (file)
@@ -15975,9 +15975,28 @@ whereas @w{@samp{[-2 ..@: 3] ^ 2}} is @samp{[0 ..@: 9]}.
 @mindex @null
 @end ignore
 @tindex /
-The @kbd{/} (@code{calc-divide}) command divides two numbers.  Note that
-when using algebraic entry, @samp{/} has lower precedence than @samp{*}, 
-so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.
+The @kbd{/} (@code{calc-divide}) command divides two numbers.  
+
+When combining multiplication and division in an algebraic formula, it
+is good style to use parentheses to distinguish between possible
+interpretations; the expression @samp{a/b*c} should be written
+@samp{(a/b)*c} or @samp{a/(b*c)}, as appropriate.  Without the
+parentheses, Calc will interpret @samp{a/b*c} as @samp{a/(b*c)}, since
+in algebraic entry Calc gives division a lower precedence than
+multiplication. (This is not standard across all computer languages, and
+Calc may change the precedence depending on the language mode being used.  
+@xref{Language Modes}.)  This default ordering can be changed by setting
+the customizable variable @code{calc-multiplication-has-precedence} to
+@code{nil} (@pxref{Customizing Calc}); this will give division a higher
+precedence than multiplication.  Note that Calc's default choice of
+precedence allows @samp{a b / c d} to be used as a shortcut for
+@smallexample
+@group
+a b
+---.
+c d
+@end group
+@end smallexample
 
 When dividing a scalar @expr{B} by a square matrix @expr{A}, the
 computation performed is @expr{B} times the inverse of @expr{A}.  This
@@ -34899,10 +34918,9 @@ See @ref{Graphics}.@*
 The variable @code{calc-gnuplot-name} should be the name of the
 GNUPLOT program (a string).  If you have GNUPLOT installed on your
 system but Calc is unable to find it, you may need to set this
-variable.  (@pxref{Customizing Calc})
-You may also need to set some Lisp variables to show Calc how to run
-GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} .  The default value
-of @code{calc-gnuplot-name} is @code{"gnuplot"}.
+variable.  You may also need to set some Lisp variables to show Calc how
+to run GNUPLOT on your system, see @ref{Devices, ,Graphical Devices} .
+The default value of @code{calc-gnuplot-name} is @code{"gnuplot"}.
 @end defvar
 
 @defvar  calc-gnuplot-plot-command
@@ -35158,6 +35176,18 @@ should also be added to @code{calc-embedded-announce-formula-alist}
 and @code{calc-embedded-open-close-plain-alist}.
 @end defvar
 
+@defvar calc-multiplication-has-precedence
+The variable @code{calc-multiplication-has-precedence} determines
+whether multiplication or division has precedence in algebraic formulas
+in normal language modes.  If @code{calc-multiplication-has-precedence}
+is non-@code{nil}, then multiplication has precedence, and so for
+example @samp{a/b*c} will be interpreted as @samp{a/(b*c)}. If
+@code{calc-multiplication-has-precedence} is @code{nil}, then division
+has precedence, and so for example @samp{a/b*c} will be interpreted as
+@samp{(a/b)*c}.  The default value of
+@code{calc-multiplication-has-precedence} is @code{t}.
+@end defvar
+
 @node Reporting Bugs, Summary, Customizing Calc, Top
 @appendix Reporting Bugs