From 89046ea50a3ac9e264513576cf020cfa67d750ea Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Wed, 20 Jun 2007 15:20:53 +0000 Subject: [PATCH] (Basic Arithmetic, Customizing Calc): Mention `calc-multiplication-has-precedence'. --- lisp/ChangeLog | 34 ++++++++++++++++++++++++++++++++++ man/ChangeLog | 5 +++++ man/calc.texi | 44 +++++++++++++++++++++++++++++++++++++------- 3 files changed, 76 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 02745e8149a..d446ef93926 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -50,6 +50,40 @@ * progmodes/vera-mode.el: New file. +2007-06-19 Jay Belanger + + * 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 * vc-hg.el: New file. diff --git a/man/ChangeLog b/man/ChangeLog index 1283f03c14b..8de0d9807f2 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2007-06-19 Jay Belanger + + * calc.texi (Basic Arithmetic, Customizing Calc): Mention + the variable `calc-multiplication-has-precedence'. + 2007-06-19 Carsten Dominik * org.texi (Tag): Section swapped with node Timestamps. diff --git a/man/calc.texi b/man/calc.texi index ecf85a450bd..01c153a230a 100644 --- a/man/calc.texi +++ b/man/calc.texi @@ -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 -- 2.39.2