summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/bnumexpr
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-10-14 22:31:01 +0000
committerKarl Berry <karl@freefriends.org>2015-10-14 22:31:01 +0000
commit8670e7c083a28342f15202694a11870d188ac3b9 (patch)
treeaf2d86afc8b75364089f0ff66ac9496f002efc5c /Master/texmf-dist/source/latex/bnumexpr
parentd8affc4836b36f9a08f2502e9650bf302952561c (diff)
bnumexpr (14oct15)
git-svn-id: svn://tug.org/texlive/trunk@38638 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/bnumexpr')
-rw-r--r--Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx74
1 files changed, 41 insertions, 33 deletions
diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx
index 47db3a09200..7b7b67c6c23 100644
--- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx
+++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx
@@ -1,18 +1,18 @@
% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
%<*dtx>
-\def\bnedtxtimestamp {Time-stamp: <13-10-2015 at 18:40:32 CEST>}
+\def\bnedtxtimestamp {Time-stamp: <14-10-2015 at 16:24:00 CEST>}
\iffalse
%</dtx>
%<*drv>
%% ---------------------------------------------------------------
-\def\bnedocdate {2015/10/13} % package bnumexpr documentation date
-\def\bnepackdate{2015/10/13} % package bnumexpr date
-\def\bneversion {1.2} % package bnumexpr version
+\def\bnedocdate {2015/10/14} % package bnumexpr documentation date
+\def\bnepackdate{2015/10/14} % package bnumexpr date
+\def\bneversion {1.2a} % package bnumexpr version
%</drv>
%<*readme>--------------------------------------------------------
| Source: bnumexpr.dtx
-| Version: v1.2, 2015/10/13 (doc: 2015/10/13)
+| Version: v1.2a, 2015/10/14 (doc: 2015/10/14)
| Author: Jean-Francois Burnol
| Info: Expressions with big integers
| License: LPPL 1.3c or later
@@ -144,7 +144,7 @@ and the derived files
%%
%</!readme>
%<*changes>-------------------------------------------------------
-\item[1.2 (2015/10/13)]
+\item[1.2a (2015/10/14)]
\begin{itemize}
\item requires \xintcorename |1.2| or later (if not using option |custom|).
\item additions to the syntax: factorial |!|, truncated division
@@ -176,11 +176,11 @@ and the derived files
control sequence encapsulating the computation result had |\relax|
meaning. But removing this assumption was only a matter of letting
|\BNE_protect| protect two, not one, tokens. This will be backported to
- next version of |xintexpr.sty|, naturally.
+ next version of \xintexprname, naturally (done with |xintexpr.sty 1.1|).
\end{itemize}
\item[1.1 (2014/09/21)] First release. This is down-scaled from the
- (development version of) |xintexpr.sty|. Motivation came the previous day
+ (development version of) \xintexprname. Motivation came the previous day
from a chat with \textsc{Joseph Wright} over big int status in \LaTeX3.
The |\bnumexpr...\relax| parser can be used on top of big int macros of
one's choice. Functionalities limited to the basic operations. I leave
@@ -428,11 +428,20 @@ pdfpagemode=UseOutlines}
% argument, et en particulier dans un \footnote{}. Mais utilise
% \scantokens et macro délimitée maintenant.
+%\def\jf@makeletter #1{\catcode`#111\relax }
+
\def\verb #1%
{%
\relax\leavevmode\null
\begingroup
\MicroFont
+ \catcode`_ 11 \catcode`! 11 \catcode`: 11
+ \catcode`< 11 \catcode`> 11
+ % \scantokens will have a result of inserting a space after cs's.
+ % hence the need to have the catcodes of things like _ right.
+ % I also need < for > for one occasion in code comments
+ % naturally won't work in footnotes though.
+ % this code is truly not satisfying, but enough for my needs here.
\def\@jfverb ##1#1{\let\do\@makeother \dospecials
\makestarlowast
%\let\do\do@noligs \verbatim@nolig@list % not needed here
@@ -598,19 +607,19 @@ potential impact on the memory of \TeX{} (the string pool, the hash
table) because each intermediate number is stored as a dummy control
sequence name during processing. After thousands of evaluations with
numbers having hundreds of digits parts of the \TeX{} memory will become
-saturated and end the |(pdf)etex| run (but the problem can in theory be
-avoided through the use of a ``bigger'' \TeX{} compiled with enlarged
+saturated and end the \verb?latex|pdflatex? run (but the problem can in theory be
+avoided through the use of a ``bigger'' |pdfetex| compiled with enlarged
memory parameters). Anyhow, computations with thousands of digits take
time, and this is probably a more stringent constraint.
-If the same expession needs to be evaluated again and again tens of
+If the same expression needs to be evaluated again and again tens of
thousands of times, it may be necessary to drop use of \bnumname and
either use directly the macros from package \xintcorename, or apply
|\xintNewIIExpr| from package \xintexprname to first construct the
possibly very complicated nested macro.
-The \eTeX{} extensions are required (default on all modern installations, with
-the exception of the |tex| executable, one should use |etex| rather).
+The \eTeX{} extensions are required (this is the default on all modern
+installations for \verb?latex|pdflatex? and also for \verb?xelatex|lualatex?).
\section{Printing big numbers}
@@ -651,7 +660,7 @@ precedence as the multiplication |*|. The modulo |/:| is associated
with truncated division |//|.
The factorial postfix |!| has highest precedence. The minus signs
-inherit the precedence level of the previously encountered operators.
+inherit the precedence level of the previously encountered infix operators.
\section{Option custom, \csh{bnumexprsetup}}\label{sec:options}
@@ -690,7 +699,9 @@ obeyed if the extra key |opp| is used with \csa{bnumexprsetup} to
specify a suitable macro for the opposite of a number. This macro will
be presented not with a braced argument but directly with a sequence
of digits (either as gathered by the parser which skips leading
-zeros, or in the format produced by the other arithmetic macros).
+zeros, or as produced by the other arithmetic macros and then there
+could be a minus, or even a plus if macros others than the ones from
+\xintcorename have been used).
Thus, |opp| could identify a plus sign |+| upfront and then act
adequately.\footnote{see \csa{BNE_Op_opp} in the code for the
default.}
@@ -747,7 +758,7 @@ The sole package option is |custom|: it tells \bnumname not to load
% \subsection{Package identification and catcode setup}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{bnumexpr}[2015/10/13 v1.2 Expressions with big integers (jfB)]%
+\ProvidesPackage{bnumexpr}[2015/10/14 v1.2a Expressions with big integers (jfB)]%
\edef\BNErestorecatcodes {\catcode`\noexpand\!\the\catcode`\!
\catcode`\noexpand\?\the\catcode`\?
\catcode`\noexpand\_\the\catcode`\_
@@ -796,13 +807,13 @@ The sole package option is |custom|: it tells \bnumname not to load
\def\xint_zapspaces #1 #2{#1#2\xint_zapspaces }%
% \end{macrocode}
% \subsection{\csh{bnumexprsetup}}
-% New with |v1.2|. Replaces removed |\bnumexprUsesbigintcalc| etc...
+% New with |v1.2a|. Replaces removed |\bnumexprUsesbigintcalc| etc...
% \begin{macrocode}
\catcode`! 3
\def\bnumexprsetup #1{\BNE_parsekeys #1,=!,}%
\def\BNE_parsekeys #1=#2#3,{\ifx!#2\expandafter\BNE_parsedone\fi
- \edef\BNE_tmpc{\xint_zapspaces #1 \xint_gobble_i}%
- \expandafter\let\csname BNE_Op_\BNE_tmpc\endcsname=#2\BNE_parsekeys
+ \expandafter
+\let\csname BNE_Op_\xint_zapspaces #1 \xint_gobble_i\endcsname=#2\BNE_parsekeys
}%
\catcode`! 11
\def\BNE_parsedone #1\BNE_parsekeys {}%
@@ -825,7 +836,7 @@ The sole package option is |custom|: it tells \bnumname not to load
% possibly comma separated values. Here we may just identify |_print| with
% |_unlock|.
%
-% With |v1.2| the gathering of numbers happens directly inside
+% With |v1.2a| the gathering of numbers happens directly inside
% |\csname...\endcsname|. There is no more a ``locking'' macro.
% \begin{macrocode}
\def\bnumexpr {\romannumeral0\bnumeval }%
@@ -850,13 +861,13 @@ The sole package option is |custom|: it tells \bnumname not to load
% |\count| or |\dimen| will get fetched to |\number| (in case of a count
% variable, this provides a full locked number but |\count0 1| for example is
% like |1231| if |\count0|'s value is |123|); a digit triggers the
-% number scanner. After the digit scanner finishes the integer is trimmed of
-% leading zeros and locked as a single token into a |\csname .=...\endcsname|.
+% number scanner. With |v1.2a| the gathering of digits happens directly inside
+% |\csname .=...\endcsname|. Leading zeroes are trimmed directly.
% The flow then proceeds with |\BNE_getop| which looks for the next operator
% or possibly the end of the expression. Note: |\bnumexpr\relax| is
% illegal.
%
-% Extended in v1.2 to recognize |\ht|, etc...
+% Extended in v1.2a to recognize |\ht|, etc...
% \begin{macrocode}
\def\BNE_getnext #1%
{%
@@ -987,7 +998,7 @@ The sole package option is |custom|: it tells \bnumname not to load
% things are simpler but I have kept the general scheme, thus the actual macro
% to be used for the <operator> is not decided immediately.
%
-% |v1.2| adds a technique for allowing two-letters operators, for
+% |v1.2a| adds a technique for allowing two-letters operators, for
% |//|, |/:| and |**|.
% \begin{macrocode}
\def\BNE_getop #1#2% this #1 is the current locked computed value
@@ -1083,7 +1094,7 @@ The sole package option is |custom|: it tells \bnumname not to load
% must ``f-expand'' their arguments, and know how to handle then big integers
% having no leading zeros and at most a minus sign.
%
-% |v1.2| adds |//| for truncated division, |/:| for modulo operations
+% |v1.2a| adds |//| for truncated division, |/:| for modulo operations
% and |**| for powers (synonym to |^|).
% \begin{macrocode}
\def\BNE_tmpc #1#2#3#4#5#6#7%
@@ -1122,21 +1133,18 @@ The sole package option is |custom|: it tells \bnumname not to load
\BNE_tmpb *{vii}{BNE_Op_mul}%
\BNE_tmpb /{vii}{BNE_Op_divround}%
\BNE_tmpb ^{viii}{BNE_Op_pow}%
-\expandafter\def\csname BNE_itself_**\endcsname {**}%
+\expandafter\def\csname BNE_itself_**\endcsname {^}% shortcut for alias
\expandafter\def\csname BNE_itself_//\endcsname {//}%
\expandafter\def\csname BNE_itself_/:\endcsname {/:}%
-\BNE_tmpb {**}{viii}{BNE_Op_pow}%
\BNE_tmpb {//}{vii}{BNE_Op_divtrunc}%
\BNE_tmpb {/:}{vii}{BNE_Op_mod}%
% \end{macrocode}
% \subsection{! as postfix factorial operator}
-% New with |v1.2|.
+% New with |v1.2a|.
% \begin{macrocode}
\let\BNE_precedence_! \xint_c_x
-\def\BNE_tmpa #1{\def\BNE_op_! ##1{\expandafter\BNE_getop
- \csname .=#1{\BNE_unlock ##1}\endcsname
- }}%
-\BNE_tmpa\BNE_Op_fac
+\def\BNE_op_! #1%
+ {\expandafter\BNE_getop\csname .=\BNE_Op_fac{\BNE_unlock #1}\endcsname }%
% \end{macrocode}
% \subsection{The minus as prefix operator of variable precedence level}
% It inherits the level of precedence of the previous operator.
@@ -1239,7 +1247,7 @@ The sole package option is |custom|: it tells \bnumname not to load
Right bracket \] Circumflex \^ Underscore \_
Grave accent \` Left brace \{ Vertical bar \|
Right brace \} Tilde \~}
-\CheckSum {868}
+\CheckSum {861}
\makeatletter\check@checksum\makeatother
\Finale
%% End of file xint.dtx