summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/xlop/xlop-doc.tex')
-rw-r--r--Master/texmf-dist/doc/generic/xlop/xlop-doc.tex56
1 files changed, 49 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex b/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex
index 396c09e141d..fb623b21d04 100644
--- a/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex
+++ b/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex
@@ -248,7 +248,7 @@ page~\pageref{sec:Creation d'operations complexes}.
\index{number!valid}In practice, what does it mean all these rules?
First, they means that a number writes in a decimal form can be
preceded by any sequence of plus or minus signs. Obviously, if there
-is a odd number of minus signs, the number will be negative. Next, a
+is an odd number of minus signs, the number will be negative. Next, a
decimal number admits only one decimal separator symbol which can
be a dot or a comma, this one can be put anywhere in the
number. Finally, a number is write in basis~10. Be carefull: these
@@ -262,7 +262,7 @@ variable name with the character \texttt{@}.
\index{parameter!syntax|(}
Parameter assignments are local to the macro when they are indicated
in the optional argument. To make global a parameter assignment, you
-have to use the \macro{opset} macro. For example:
+have to use the \macro{opset} macro. For instance:
\begin{Verbatim}[xrightmargin=0pt]
\opset{decimalsepsymbol={,}}
\end{Verbatim}
@@ -779,7 +779,7 @@ only) under the control of \parameter{maxdivstep},
\parameter{safedivstep}, and \parameter{period} parameters. It is only
partially true because a classical division will stop automatically
when a remainder will be zero, whatever the values of these three
-parameters and a euclidean division will stop with an integer quotient
+parameters and an euclidean division will stop with an integer quotient
without attention for these three parameters.
\begin{SideBySideExample}
\opdiv{25}{7}
@@ -845,7 +845,7 @@ $\left\lfloor\frac{2^{31}-1}{10}\right\rfloor = 214748364$.
In order to avoid too long calculations, \package{xlop} don't process
beyond the value of \parameter{safedivstep} parameter in division with
period. Its default value is~50. However, \package{xlop} package show
-this problem. For example, if you ask for such a division with the
+this problem. For instance, if you ask for such a division with the
code:
\begin{Verbatim}[xrightmargin=0pt,frame=none]
\opdiv[period]{1}{289}
@@ -1388,6 +1388,42 @@ work.
\end{tabular}
\end{center}
+\index{square root}
+With version~0.26 comes the square root operation:
+\macro{opsqrt}. This macro has not the same syntax as the other
+arithmetic macros since there is no starred version. In fact, there is
+a way to display a processing of square root but it's really not
+current. I'm pretty old and my grandfather told me that he saw
+this method when he was young! Therefore, there is an \macro{opgfsqrt}
+macro to display the operation (``gf'' for grandfather).
+
+Let us see the first macro: the one which calculates the square root
+and store the result in a xlop variable:
+\begin{SideBySideExample}
+ \opsqrt{2}{sqrt2}
+ $\sqrt{2}\approx\opprint{sqrt2}$
+\end{SideBySideExample}
+This macro shares the parameter \parameter{maxdivstep} with division
+macros. For instance:
+\begin{SideBySideExample}
+ \opsqrt[maxdivstep=15]{2}{sqrt2}
+ $\sqrt{2}\approx\opprint{sqrt2}$
+\end{SideBySideExample}
+
+For ``grandfather'' display, I have not the energy to explain the
+processus. It's based on remarkable identity
+$(a+b)^2=a^2+2ab+b^2$. Thanks to Jean-Michel Sarlat who had taken time
+to explain this method in order that I can write it for
+\package{xlop}!
+
+Here is an example for square root of 15:
+\begin{CenterExample}
+ \opgfsqrt[maxdivstep=5]{15}
+\end{CenterExample}
+This method is horrible. It's horrible for human being. It's horrible
+for computer. For instance, the real operation isn't make that way:
+it uses Heron method.
+
\index{complex expression|(}
The very last macro we have to study is \macro{opexpr}. It calculates
a complex expression. This macro needs two parameters: the first one
@@ -1564,7 +1600,7 @@ expected.
\index{compilation time|)}\index{time (calculation)|)}%
\newpage
-\section{Macros List}
+\section{Macro List}
\label{sec:Liste des macros}
\index{macros!table of|(}%
\noindent\begin{longtable}{|l|p{6.3cm}|}
@@ -1641,6 +1677,9 @@ expected.
\verb+\opgetintegerdigit{n}{T}{N}+ &
Build the number \verb+N+ width the only digit in slot
\verb+T+ of integer part of \verb+n+. \\\hline
+ \verb+\opgfsqrt{n}+ &
+ Display the old timed way to calculate a square root of
+ \verb+n+. \\\hline
\verb+\ophline(T1,T2){T3}+ &
Draw a horizontal rule of length \verb+T3+, of thickness
\verb+hrulewidth+, and which begin at \verb+(T1,T2)+ in relation to
@@ -1690,6 +1729,8 @@ expected.
\verb+\opsetintegerdigit{n}{T}{N}+ &
Modify the digit of rank \verb+T+ in integer part of \verb+N+ in
order to have the value \verb+n+ for this digit. \\\hline
+ \verb+\opsqrt{n}{N}+ & Put square root of \verb+n+ in
+ \verb+N+. \\\hline
\verb+\opsub[P]{n1}{n2}+ &
Display result of \verb+n1-n2+. \\\hline
\verb+\opsub*{n1}{n2}{N}+ &
@@ -1816,7 +1857,8 @@ In this table, parameters:
shifting. \\\hline
\verb+maxdivstep+ &
\verb+10+ &
- Maximal number of steps in division. \\\hline
+ Maximal number of steps in division or in square root
+ operation. \\\hline
\verb+safedivstep+ &
\verb+50+ &
Maximal number of steps in division when there is a period to
@@ -2070,7 +2112,7 @@ ones).
\end{SideBySideExample}
Note that this code is very bad: it is very slow and don't give
-anything against native \TeX{} operations. It is only a educational
+anything against native \TeX{} operations. It is only an educational
example. Note also that the tricks to put loop into loop with macro
\verb+\testprimality+ inside a group. \package{xlop} operations give
global results.\index{global allocation}