[latex3-commits] [l3svn] r6785 - Get more uniform random numbers
noreply at latex-project.org
noreply at latex-project.org
Tue Dec 6 06:49:49 CET 2016
Author: bruno
Date: 2016-12-06 06:49:48 +0100 (Tue, 06 Dec 2016)
New Revision: 6785
Added:
trunk/l3experimental/l3str/testfiles/m3tl-analysis001.ptex.tlg
trunk/l3experimental/l3str/testfiles/m3tl-analysis001.uptex.tlg
trunk/l3kernel/testfiles/m3int001.ptex.tlg
trunk/l3kernel/testfiles/m3int002.ptex.tlg
Modified:
trunk/l3experimental/l3str/testfiles/m3tl-analysis001.tlg
trunk/l3kernel/l3fp-random.dtx
trunk/l3kernel/l3fp.dtx
trunk/l3kernel/testfiles/m3expl001.luatex.tlg
trunk/l3kernel/testfiles/m3expl001.ptex.tlg
trunk/l3kernel/testfiles/m3expl001.tlg
trunk/l3kernel/testfiles/m3expl001.uptex.tlg
trunk/l3kernel/testfiles/m3expl001.xetex.tlg
trunk/l3kernel/testfiles/m3expl002.luatex.tlg
trunk/l3kernel/testfiles/m3expl002.tlg
trunk/l3kernel/testfiles/m3expl003.luatex.tlg
trunk/l3kernel/testfiles/m3expl003.ptex.tlg
trunk/l3kernel/testfiles/m3expl003.tlg
trunk/l3kernel/testfiles/m3expl003.uptex.tlg
trunk/l3kernel/testfiles/m3expl003.xetex.tlg
trunk/l3kernel/testfiles/m3expl004.luatex.tlg
trunk/l3kernel/testfiles/m3expl004.tlg
trunk/l3kernel/testfiles/m3expl006.luatex.tlg
trunk/l3kernel/testfiles/m3expl006.tlg
trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg
trunk/l3kernel/testfiles/m3fp-rand001.tlg
trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg
trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg
trunk/l3kernel/testfiles/m3int001.luatex.tlg
trunk/l3kernel/testfiles/m3int001.tlg
trunk/l3kernel/testfiles/m3int002.luatex.tlg
trunk/l3kernel/testfiles/m3int002.tlg
Log:
Get more uniform random numbers
This is a complete rewrite of l3fp-random, to work around
a bug in \pdfuniformdeviate, namely that regardless of its
argument it can only produce 2^28 values.
Added: trunk/l3experimental/l3str/testfiles/m3tl-analysis001.ptex.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3tl-analysis001.ptex.tlg (rev 0)
+++ trunk/l3experimental/l3str/testfiles/m3tl-analysis001.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -0,0 +1,109 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Bruno Le Floch
+============================================================
+TEST 1: tl_show_analysis basic
+============================================================
+The token list \c_empty_tl is empty
+> .
+<recently read> }
+l. ... }
+The token list \c_catcode_other_space_tl contains the tokens:
+> (the character ).
+<recently read> }
+l. ... }
+The token list is empty
+> .
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> (blank space ).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> \ (control sequence=\ ).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> { (begin-group character {)
+> } (end-group character }).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> a (the letter a)
+> b (the letter b)
+> c (the letter c).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> a (the letter a)
+> { (begin-group character {)
+> \b (control sequence=macro:->\OT1-cmd \b \OT1\b )
+> c (the letter c)
+> ! (blank space !)
+> } (end-group character })
+> \ (control sequence=\ )
+> ! (blank space !).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 2: tl_show_analysis in alignment
+============================================================
+The token list is empty
+> .
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &)
+> { (begin-group character {)
+> & (alignment tab character &)
+> } (end-group character })
+> & (alignment tab character &)
+> \tex_cr:D (control sequence=\cr).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 3: tl_show_analysis weird tokens
+============================================================
+The token list contains the tokens:
+> \bgroup (control sequence=begin-group character {)
+> \c_group_begin_token (control sequence=begin-group character {)
+> { (active character=undefined)
+> (begin-group character )
+> - (blank space -)
+> \abc def g (control sequence=\relax)
+> \abc (control sequence=\relax)
+> (end-group character )
+> } (active character=undefined).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> \c_group_end_token (control sequence=end-group character })
+> \egroup (control sequence=end-group character }).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 4: Showing the values of registers
+============================================================
+The token list contains the tokens:
+> \l_foo_int (control sequence=\count1234=12)
+> \l_foo_toks (control sequence=\toks1234=abc)
+> \c_test_int (control sequence=\count138=-1)
+> \c_zero_skip (control sequence=\skip71=0.0pt)
+> \c_zero_muskip (control sequence=\muskip40)
+> \tex_count:D (control sequence=\count)
+> \tex_dimendef:D (control sequence=\dimendef).
+<recently read> }
+l. ... }
+============================================================
Property changes on: trunk/l3experimental/l3str/testfiles/m3tl-analysis001.ptex.tlg
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/l3experimental/l3str/testfiles/m3tl-analysis001.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3tl-analysis001.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3experimental/l3str/testfiles/m3tl-analysis001.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -99,7 +99,7 @@
The token list contains the tokens:
> \l_foo_int (control sequence=\count1234=12)
> \l_foo_toks (control sequence=\toks1234=abc)
-> \c_test_int (control sequence=\count138=-1)
+> \c_test_int (control sequence=\count141=-1)
> \c_zero_skip (control sequence=\skip71=0.0pt)
> \c_zero_muskip (control sequence=\muskip40)
> \tex_count:D (control sequence=\count)
Added: trunk/l3experimental/l3str/testfiles/m3tl-analysis001.uptex.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3tl-analysis001.uptex.tlg (rev 0)
+++ trunk/l3experimental/l3str/testfiles/m3tl-analysis001.uptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -0,0 +1,109 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Bruno Le Floch
+============================================================
+TEST 1: tl_show_analysis basic
+============================================================
+The token list \c_empty_tl is empty
+> .
+<recently read> }
+l. ... }
+The token list \c_catcode_other_space_tl contains the tokens:
+> (the character ).
+<recently read> }
+l. ... }
+The token list is empty
+> .
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> (blank space ).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> \ (control sequence=\ ).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> { (begin-group character {)
+> } (end-group character }).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> a (the letter a)
+> b (the letter b)
+> c (the letter c).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> a (the letter a)
+> { (begin-group character {)
+> \b (control sequence=macro:->\OT1-cmd \b \OT1\b )
+> c (the letter c)
+> ! (blank space !)
+> } (end-group character })
+> \ (control sequence=\ )
+> ! (blank space !).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 2: tl_show_analysis in alignment
+============================================================
+The token list is empty
+> .
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> & (alignment tab character &)
+> { (begin-group character {)
+> & (alignment tab character &)
+> } (end-group character })
+> & (alignment tab character &)
+> \tex_cr:D (control sequence=\cr).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 3: tl_show_analysis weird tokens
+============================================================
+The token list contains the tokens:
+> \bgroup (control sequence=begin-group character {)
+> \c_group_begin_token (control sequence=begin-group character {)
+> { (active character=undefined)
+> (begin-group character )
+> - (blank space -)
+> \abc def g (control sequence=\relax)
+> \abc (control sequence=\relax)
+> (end-group character )
+> } (active character=undefined).
+<recently read> }
+l. ... }
+The token list contains the tokens:
+> \c_group_end_token (control sequence=end-group character })
+> \egroup (control sequence=end-group character }).
+<recently read> }
+l. ... }
+============================================================
+============================================================
+TEST 4: Showing the values of registers
+============================================================
+The token list contains the tokens:
+> \l_foo_int (control sequence=\count1234=12)
+> \l_foo_toks (control sequence=\toks1234=abc)
+> \c_test_int (control sequence=\count138=-1)
+> \c_zero_skip (control sequence=\skip71=0.0pt)
+> \c_zero_muskip (control sequence=\muskip40)
+> \tex_count:D (control sequence=\count)
+> \tex_dimendef:D (control sequence=\dimendef).
+<recently read> }
+l. ... }
+============================================================
Property changes on: trunk/l3experimental/l3str/testfiles/m3tl-analysis001.uptex.tlg
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/l3kernel/l3fp-random.dtx
===================================================================
--- trunk/l3kernel/l3fp-random.dtx 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/l3fp-random.dtx 2016-12-06 05:49:48 UTC (rev 6785)
@@ -76,15 +76,127 @@
%<@@=fp>
% \end{macrocode}
%
+% \subsection{Engine support}
+%
+% At present, \XeTeX{}, \pTeX{} and \upTeX{} do not provide random
+% numbers, while \LuaTeX{} and \pdfTeX{} provide the primitive
+% \cs{pdftex_uniformdeviate:D} (\tn{pdfuniformdeviate} in \pdfTeX{} and
+% \tn{uniformdeviate} in \LuaTeX{}). We write the test twice simply in
+% order to write the \texttt{false} branch first.
+% \begin{macrocode}
+\cs_if_exist:NF \pdftex_uniformdeviate:D
+ {
+ \__msg_kernel_new:nnn { kernel } { fp-no-random }
+ { Random~numbers~unavailable }
+ \cs_new:Npn \@@_rand_o:Nw ? #1 @
+ {
+ \__msg_kernel_expandable_error:nn { kernel } { fp-no-random }
+ \exp_after:wN \c_nan_fp
+ }
+ \cs_new_eq:NN \@@_randint_o:Nw \@@_rand_o:Nw
+ }
+\cs_if_exist:NT \pdftex_uniformdeviate:D
+ {
+% \end{macrocode}
+%
+% \begin{macro}[EXP, int]{\@@_rand_uniform:}
+% \begin{variable}
+% {
+% \c_@@_rand_size_int,
+% \c_@@_rand_four_int,
+% \c_@@_rand_eight_int,
+% }
+% The \cs{pdftex_uniformdeviate:D} primitive gives a pseudo-random
+% integer in a range $[0,n-1]$ of the user's choice. This number is
+% meant to be uniformly distributed, but is produced by rescaling a
+% uniform pseudo-random integer in $[0,2^{28}-1]$. For instance,
+% setting~$n$ to (any multiple of) $2^{29}$ gives only even values.
+% Thus it is only safe to call \cs{pdftex_uniformdeviate:D} with
+% argument $2^{28}$. We will also use variants of this number rounded
+% down to multiples of $10^4$ and $10^8$.
+% \begin{macrocode}
+\cs_new:Npn \@@_rand_uniform:
+ { \pdftex_uniformdeviate:D \c_@@_rand_size_int }
+\int_const:Nn \c_@@_rand_size_int { 268 435 456 }
+\int_const:Nn \c_@@_rand_four_int { 268 430 000 }
+\int_const:Nn \c_@@_rand_eight_int { 200 000 000 }
+% \end{macrocode}
+% \end{variable}
+% \end{macro}
+%
+% \begin{macro}[EXP, int]{\@@_rand_myriads:n}
+% \begin{macro}[EXP, aux]
+% {
+% \@@_rand_myriads_loop:nn,
+% \@@_rand_myriads_get:w,
+% \@@_rand_myriads_last:,
+% \@@_rand_myriads_last:w,
+% }
+% Used as \cs{@@_rand_myriads:n} |{XXX}| with one input character per
+% block of four digit we want. Given a pseudo-random integer from the
+% primitive, we extract $2$ blocks of digits if possible, namely if
+% the integer is less than $2\times 10^8$. If that's not possible,
+% we try to extract $1$~block, which succeeds in the range $[2\times
+% 10^8, 26843\times 10^4)$. For the $5456$ remaining possible values
+% we just throw away the random integer and get a new one. Depending
+% on whether we got $2$, $1$, or~$0$ blocks, remove the same number of
+% characters from the input stream with \cs{use_i:nnn}, \cs{use_i:nn}
+% or nothing.
+% \begin{macrocode}
+\cs_new:Npn \@@_rand_myriads:n #1
+ {
+ \@@_rand_myriads_loop:nn #1
+ { ? \use_i_delimit_by_q_stop:nw \@@_rand_myriads_last: }
+ { ? \use_none_delimit_by_q_stop:w } \q_stop
+ }
+\cs_new:Npn \@@_rand_myriads_loop:nn #1#2
+ {
+ \use_none:n #2
+ \exp_after:wN \@@_rand_myriads_get:w
+ \__int_value:w \@@_rand_uniform: ; {#1}{#2}
+ }
+\cs_new:Npn \@@_rand_myriads_get:w #1 ;
+ {
+ \if_int_compare:w #1 < \c_@@_rand_eight_int
+ \exp_after:wN \use_none:n
+ \__int_value:w \__int_eval:w
+ \c_@@_rand_eight_int + #1 \__int_eval_end:
+ \exp_after:wN \use_i:nnn
+ \else:
+ \if_int_compare:w #1 < \c_@@_rand_four_int
+ \exp_after:wN \use_none:nnnnn
+ \__int_value:w \__int_eval:w
+ \c_@@_rand_four_int + #1 \__int_eval_end:
+ \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn
+ \fi:
+ \fi:
+ \@@_rand_myriads_loop:nn
+ }
+\cs_new:Npn \@@_rand_myriads_last:
+ {
+ \exp_after:wN \@@_rand_myriads_last:w
+ \__int_value:w \@@_rand_uniform: ;
+ }
+\cs_new:Npn \@@_rand_myriads_last:w #1 ;
+ {
+ \if_int_compare:w #1 < \c_@@_rand_four_int
+ \exp_after:wN \use_none:nnnnn
+ \__int_value:w \__int_eval:w
+ \c_@@_rand_four_int + #1 \__int_eval_end:
+ \else:
+ \exp_after:wN \@@_rand_myriads_last:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Random floating point}
%
% \begin{macro}[EXP, int]{\@@_rand_o:Nw}
-% \begin{macro}[EXP, aux]{\@@_rand_o:}
-% Check that |random| was called without argument. Random numbers are
-% only available if the engine defines a primitive equivalent to
-% \pdfTeX{}'s \tn{pdfuniformdeviate}. A random floating point number
-% in $[0,1)$, uniformly distributed with equal-spaced steps of
-% $10^{-16}$ is obtained by combining two integers in $[0,10^8-1]$.
+% \begin{macro}[EXP, aux]{\@@_rand_o:, \@@_rand_o:w}
+% First we check that |random| was called without argument. Then get
+% four blocks of four digits.
% \begin{macrocode}
\cs_new:Npn \@@_rand_o:Nw ? #1 @
{
@@ -96,29 +208,8 @@
\exp_after:wN \c_nan_fp
}
}
-\cs_if_exist:NTF \pdftex_uniformdeviate:D
- {
- \cs_new:Npn \@@_rand_o:
- {
- \@@_parse_o:n
- {
- .
- \exp_after:wN \use_none:n
- \__int_value:w \__int_eval:w 1 0000 0000 +
- \pdftex_uniformdeviate:D 1 0000 0000 \__int_eval_end:
- \exp_after:wN \use_none:n
- \__int_value:w \__int_eval:w 1 0000 0000 +
- \pdftex_uniformdeviate:D 1 0000 0000 \__int_eval_end:
- }
- }
- }
- {
- \cs_new:Npn \@@_rand_o:
- {
- \__msg_kernel_expandable_error:nn { kernel } { fp-no-random }
- \exp_after:wN \c_nan_fp
- }
- }
+\cs_new:Npn \@@_rand_o:
+ { \@@_parse_o:n { . \@@_rand_myriads:n { xxxx } } }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -130,29 +221,33 @@
% {
% \@@_randint_badarg:w,
% \@@_randint_e:w,
-% \@@_randint_narrow_e:nn,
-% \@@_randint_wide_e:nn,
-% \@@_randint_wide_e:nnn,
+% \@@_randint_e:wnn,
+% \@@_randint_e:wwNnn,
+% \@@_randint_e:wwwNnn,
+% \@@_randint_narrow_e:nnnn,
% \@@_randint_wide_e:nnnn,
+% \@@_randint_wide_e:wnnn,
% }
% Enforce that there is one argument (then add first argument~$1$)
% or two arguments. Enforce that they are integers in
-% $(-10^{16},10^{16})$ and ordered.
+% $(-10^{16},10^{16})$ and ordered. We distinguish narrow ranges
+% (less than $2^{28}$) from wider ones.
%
-% When the range is narrow (less than $2\times 10^9$) we can
-% directly use the primitive. Otherwise we use the primitive twice.
-% To ensure a uniform distribution we combine two uniformly
-% distributed integers into a total range greater or equal to our
-% target range and try again if the random number ended up being too
-% big.
+% For narrow ranges, compute the number~$n$ of possible outputs as
+% an integer using \cs{fp_to_int:n}, and reduce a pseudo-random
+% $28$-bit integer~$r$ modulo~$n$. On its own, this is not uniform
+% when $[0,2^{28}-1]$ does not divide evenly into intervals of
+% size~$n$. The auxiliary \cs{@@_randint_e:wwwNnn} discards the
+% pseudo-random integer if it lies in an incomplete interval, and
+% repeats.
%
-% The strange |+\c_six| ensures that the first argument of
-% \cs{@@_randint_wide_e:nnn} is larger than $10^{-8}$ times the
-% difference between the end-points even if these are near
-% $-10^{16}$ and $+10^{16}$ (their difference is rounded to sixteen
-% digits). Note that we cannot just concatenate the two random
-% numbers provided by the engine as that may give an integer up to
-% (almost) $2\times 10^{16}$ which incurs rounding.
+% For wide ranges we use the same code except for the last eight
+% digits which use \cs{@@_rand_myriads:n}. It is not safe to
+% combine the first digits with the last eight as a single string of
+% digits, as this may exceed $16$~digits and be rounded. Instead,
+% we first add the first few digits (times $10^8$) to the lower
+% bound. The result is compared to the upper bound and the process
+% repeats if needed.
% \begin{macrocode}
\cs_new:Npn \@@_randint_o:Nw ? #1 @
{
@@ -186,73 +281,64 @@
\@@_randint_badarg:w #1;
\@@_randint_badarg:w #2;
\fp_compare:nNnTF { #1; } > { #2; } { \c_one } { \c_zero }
- \fp_compare:nNnTF { #1; + 2e9 } < { #2; }
- { \@@_randint_wide_e:nn }
- { \@@_randint_narrow_e:nn }
- { #1; } { #2; }
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_randint_e:wnn
+ \@@_parse:n { #2; - #1; } { #1; } { #2; }
\or:
\@@_invalid_operation_tl_o:ff
{ randint } { \@@_array_to_clist:n { #1; #2; } }
\exp:w
\fi:
}
-\cs_if_exist:NTF \pdftex_uniformdeviate:D
+\cs_new:Npn \@@_randint_e:wnn #1;
{
- \cs_new:Npn \@@_randint_narrow_e:nn #1#2
+ \exp_after:wN \@@_randint_e:wwNnn
+ \__int_value:w \@@_rand_uniform: \exp_after:wN ;
+ \exp:w \exp_end_continue_f:w
+ \fp_compare:nNnTF { #1 ; } < \c_@@_rand_size_int
+ { \fp_to_int:n { #1 ; + 1 } ; \@@_randint_narrow_e:nnnn }
+ { \fp_to_int:n { floor(#1 ; * 1e-8 + 1) } ; \@@_randint_wide_e:nnnn }
+ }
+\cs_new:Npn \@@_randint_e:wwNnn #1 ; #2 ;
+ {
+ \exp_after:wN \@@_randint_e:wwwNnn
+ \__int_value:w \int_mod:nn {#1} {#2} ; #1 ; #2 ;
+ }
+\cs_new:Npn \@@_randint_e:wwwNnn #1 ; #2 ; #3 ; #4
+ {
+ \int_compare:nNnTF { #2 - #1 + #3 } > \c_@@_rand_size_int
{
- \@@_parse_o:n
- {
- #1 +
- \pdftex_uniformdeviate:D
- \int_eval:n { \fp_to_int:n { #2 - #1 } + \c_one }
- }
- \exp:w
+ \exp_after:wN \@@_randint_e:wwNnn
+ \__int_value:w \@@_rand_uniform: ; #3 ; #4
}
- \cs_new:Npn \@@_randint_wide_e:nn #1 #2
- {
- \exp_args:Nf \@@_randint_wide_e:nnn
- { \fp_to_int:n { ceil ( ( #2 - #1 + \c_six ) * 1e-8 ) } }
- {#1} {#2}
- }
- \cs_new:Npn \@@_randint_wide_e:nnn #1#2#3
- {
- \exp_args:Nf \@@_randint_wide_e:nnnn
- {
- \@@_parse:n
- {
- #2 +
- \pdftex_uniformdeviate:D #1 e 8 +
- \pdftex_uniformdeviate:D 1 0000 0000
- }
- }
- {#1} {#2} {#3}
- }
- \cs_new:Npn \@@_randint_wide_e:nnnn #1#2#3#4
- {
- \fp_compare:nNnTF {#1} > {#4}
- { \@@_randint_wide_e:nnn {#2} {#3} {#4} }
- { \@@_exp_after_o:w #1 \exp:w }
- }
+ { #4 {#1} {#3} }
}
+\cs_new:Npn \@@_randint_narrow_e:nnnn #1#2#3#4
+ { \@@_parse_o:n { #3 + #1 } \exp:w }
+\cs_new:Npn \@@_randint_wide_e:nnnn #1#2#3#4
{
- \cs_new:Npn \@@_randint_narrow_e:nn #1#2
+ \exp_after:wN \exp_after:wN
+ \exp_after:wN \@@_randint_wide_e:wnnn
+ \@@_parse:n { #3 + #1e8 + \@@_rand_myriads:n { xx } }
+ {#2} {#3} {#4}
+ }
+\cs_new:Npn \@@_randint_wide_e:wnnn #1 ; #2#3#4
+ {
+ \fp_compare:nNnTF { #1 ; } > {#4}
{
- \__msg_kernel_expandable_error:nn { kernel } { fp-no-random }
- \exp_after:wN \c_nan_fp \exp:w
+ \exp_after:wN \@@_randint_e:wwNnn
+ \__int_value:w \@@_rand_uniform: ; #2 ;
+ \@@_randint_wide_e:nnnn {#3} {#4}
}
- \cs_new:Npn \@@_randint_wide_e:nn #1#2
- {
- \__msg_kernel_expandable_error:nn { kernel } { fp-no-random }
- \exp_after:wN \c_nan_fp \exp:w
- }
+ { \@@_exp_after_o:w #1 ; \exp:w }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
+% End the initial conditional that ensures these commands are only
+% defined in \pdfTeX{} and \LuaTeX{}.
% \begin{macrocode}
-\__msg_kernel_new:nnn { kernel } { fp-no-random }
- { Random~numbers~unavailable }
+ }
% \end{macrocode}
%
% \begin{macrocode}
Modified: trunk/l3kernel/l3fp.dtx
===================================================================
--- trunk/l3kernel/l3fp.dtx 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/l3fp.dtx 2016-12-06 05:49:48 UTC (rev 6785)
@@ -91,7 +91,6 @@
% \item Boolean logic: negation $\mathop{!}x$, conjunction
% $x\mathop{\&\&}y$, disjunction $x\mathop{\vert\vert}y$, ternary
% operator $x\mathop{?}y\mathop{:}z$.
-% \item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$.
% \item Exponentials: $\exp x$, $\ln x$, $x^y$.
% \item Trigonometry: $\sin x$, $\cos x$, $\tan x$, $\cot x$, $\sec
% x$, $\csc x$ expecting their arguments in radians, and
@@ -123,6 +122,8 @@
% ties rounded to an even value by default, towards zero if $t=0$,
% towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$. And
% \emph{(not yet)} modulo, and \enquote{quantize}.
+% \item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$ in
+% \pdfTeX{} and \LuaTeX{} engines.
% \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians).
% \item Dimensions, automatically expressed in points, \emph{e.g.},
% \texttt{pc} is~$12$.
@@ -1180,20 +1181,36 @@
% $\sqrt{\text{\nan{}}}=\text{\nan{}}$.
% \end{function}
%
-% \begin{function}[added = 2016-11-20]{rand}
+% \begin{function}[added = 2016-12-05]{rand}
% \begin{syntax}
% \cs{fp_eval:n} \{ |rand()| \}
% \end{syntax}
% Produces a pseudo-random floating-point number (multiple of
-% $10^{-16}$) between $0$~included and $1$~excluded.
+% $10^{-16}$) between $0$~included and $1$~excluded. Available in
+% \pdfTeX{} and \LuaTeX{} engines only.
% \begin{texnote}
-% This is a wrapper around \tn{pdfuniformdeviate}. The random seed
-% can be queried using \tn{pdfrandomseed} and set using
-% \tn{pdfsetrandomseed}.
+% This is based on pseudo-random numbers provided by the engine's
+% primitive \tn{pdfuniformdeviate} in \pdfTeX{} and
+% \tn{uniformdeviate} in \LuaTeX{}. The underlying code in
+% \pdfTeX{} and \LuaTeX{} is based on Metapost, which follows an
+% additive scheme recommended in Section 3.6 of \enquote{The Art of
+% Computer Programming, Volume~2}.
+%
+% While we are more careful than \tn{uniformdeviate} to preserve
+% uniformity of the underlying stream of $28$-bit pseudo-random
+% integers, these pseudo-random numbers should of course not be
+% relied upon for serious numerical computations nor cryptography.
+%
+% The random seed can be queried using \tn{pdfrandomseed} and set
+% using \tn{pdfsetrandomseed} (in \LuaTeX{} \tn{randomseed} and
+% \tn{setrandomseed}). While a $32$-bit (signed) integer can be
+% given as a seed, only the absolute value is used and any number
+% beyond $2^{28}$ is divided by an appropriate power of~$2$. We
+% recommend using an integer in $[0,2^{28}-1]$.
% \end{texnote}
% \end{function}
%
-% \begin{function}[added = 2016-11-20]{randint}
+% \begin{function}[added = 2016-12-05]{randint}
% \begin{syntax}
% \cs{fp_eval:n} \{ |randint(| \meta{fpexpr} |)| \}
% \cs{fp_eval:n} \{ |randint(| \meta{fpexpr_1} , \meta{fpexpr_2} |)| \}
@@ -1201,12 +1218,8 @@
% Produces a pseudo-random integer between $1$~and \meta{fpexpr} or
% between \meta{fpexpr_1} and \meta{fpexpr_2} inclusive. The bounds
% must be integers in the range $(-10^{16},10^{16})$ and the first
-% must be smaller or equal to the second.
-% \begin{texnote}
-% This is a wrapper around \tn{pdfuniformdeviate}. The random seed
-% can be queried using \tn{pdfrandomseed} and set using
-% \tn{pdfsetrandomseed}.
-% \end{texnote}
+% must be smaller or equal to the second. See \texttt{rand} for
+% important comments on how these pseudo-random numbers are generated.
% \end{function}
%
% \begin{variable}[tested = m3fp-parse001]{inf, nan}
@@ -1297,8 +1310,6 @@
% \item Hyperbolic functions \texttt{cosh}, \texttt{sinh}, \texttt{tanh}.
% \item Inverse hyperbolics.
% \item Base conversion, input such as \texttt{0xAB.CDEF}.
-% \item Random numbers (pgfmath provides |rnd|, |rand|, |random|), with
-% seed reset at every \cs{fp_set:Nn}.
% \item Factorial (not with |!|), gamma function.
% \item Improve coefficients of the \texttt{sin} and \texttt{tan}
% series.
Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4082,16 +4082,29 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining \__fp_rand_uniform: on line ...
+Defining \c__fp_rand_size_int on line ...
+\c__fp_rand_size_int=\count133
+Defining \c__fp_rand_four_int on line ...
+\c__fp_rand_four_int=\count134
+Defining \c__fp_rand_eight_int on line ...
+\c__fp_rand_eight_int=\count135
+Defining \__fp_rand_myriads:n on line ...
+Defining \__fp_rand_myriads_loop:nn on line ...
+Defining \__fp_rand_myriads_get:w on line ...
+Defining \__fp_rand_myriads_last: on line ...
+Defining \__fp_rand_myriads_last:w on line ...
Defining \__fp_rand_o:Nw on line ...
Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
Defining \__fp_randint_badarg:w on line ...
Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining \__fp_randint_wide_e:nnn on line ...
+Defining \__fp_randint_e:wnn on line ...
+Defining \__fp_randint_e:wwNnn on line ...
+Defining \__fp_randint_e:wwwNnn on line ...
+Defining \__fp_randint_narrow_e:nnnn on line ...
Defining \__fp_randint_wide_e:nnnn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
+Defining \__fp_randint_wide_e:wnnn on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
@@ -4854,7 +4867,7 @@
Defining \__driver_matrix:n on line ...
Defining \l__driver_current_color_tl on line ...
Defining \l__driver_color_stack_int on line ...
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
Defining \__driver_color_ensure_current: on line ...
Defining \__driver_color_reset: on line ...
Defining \__driver_box_use_clip:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4073,14 +4073,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl001.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4073,16 +4073,29 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining \__fp_rand_uniform: on line ...
+Defining \c__fp_rand_size_int on line ...
+\c__fp_rand_size_int=\count133
+Defining \c__fp_rand_four_int on line ...
+\c__fp_rand_four_int=\count134
+Defining \c__fp_rand_eight_int on line ...
+\c__fp_rand_eight_int=\count135
+Defining \__fp_rand_myriads:n on line ...
+Defining \__fp_rand_myriads_loop:nn on line ...
+Defining \__fp_rand_myriads_get:w on line ...
+Defining \__fp_rand_myriads_last: on line ...
+Defining \__fp_rand_myriads_last:w on line ...
Defining \__fp_rand_o:Nw on line ...
Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
Defining \__fp_randint_badarg:w on line ...
Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining \__fp_randint_wide_e:nnn on line ...
+Defining \__fp_randint_e:wnn on line ...
+Defining \__fp_randint_e:wwNnn on line ...
+Defining \__fp_randint_e:wwwNnn on line ...
+Defining \__fp_randint_narrow_e:nnnn on line ...
Defining \__fp_randint_wide_e:nnnn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
+Defining \__fp_randint_wide_e:wnnn on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
@@ -5046,7 +5059,7 @@
Defining \__driver_matrix:n on line ...
Defining \l__driver_current_color_tl on line ...
Defining \l__driver_color_stack_int on line ...
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
Defining \__driver_color_ensure_current: on line ...
Defining \__driver_color_reset: on line ...
Defining \__driver_box_use_clip:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4073,14 +4073,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4080,14 +4080,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl002.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl002.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl002.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -42,6 +42,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -83,6 +86,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3expl002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl002.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl002.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -41,6 +41,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -82,6 +85,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4083,16 +4083,29 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining \__fp_rand_uniform: on line ...
+Defining \c__fp_rand_size_int on line ...
+\c__fp_rand_size_int=\count133
+Defining \c__fp_rand_four_int on line ...
+\c__fp_rand_four_int=\count134
+Defining \c__fp_rand_eight_int on line ...
+\c__fp_rand_eight_int=\count135
+Defining \__fp_rand_myriads:n on line ...
+Defining \__fp_rand_myriads_loop:nn on line ...
+Defining \__fp_rand_myriads_get:w on line ...
+Defining \__fp_rand_myriads_last: on line ...
+Defining \__fp_rand_myriads_last:w on line ...
Defining \__fp_rand_o:Nw on line ...
Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
Defining \__fp_randint_badarg:w on line ...
Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining \__fp_randint_wide_e:nnn on line ...
+Defining \__fp_randint_e:wnn on line ...
+Defining \__fp_randint_e:wwNnn on line ...
+Defining \__fp_randint_e:wwwNnn on line ...
+Defining \__fp_randint_narrow_e:nnnn on line ...
Defining \__fp_randint_wide_e:nnnn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
+Defining \__fp_randint_wide_e:wnnn on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
@@ -4855,7 +4868,7 @@
Defining \__driver_matrix:n on line ...
Defining \l__driver_current_color_tl on line ...
Defining \l__driver_color_stack_int on line ...
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
Defining \__driver_color_ensure_current: on line ...
Defining \__driver_color_reset: on line ...
Defining \__driver_box_use_clip:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4074,14 +4074,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl003.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4074,16 +4074,29 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining \__fp_rand_uniform: on line ...
+Defining \c__fp_rand_size_int on line ...
+\c__fp_rand_size_int=\count133
+Defining \c__fp_rand_four_int on line ...
+\c__fp_rand_four_int=\count134
+Defining \c__fp_rand_eight_int on line ...
+\c__fp_rand_eight_int=\count135
+Defining \__fp_rand_myriads:n on line ...
+Defining \__fp_rand_myriads_loop:nn on line ...
+Defining \__fp_rand_myriads_get:w on line ...
+Defining \__fp_rand_myriads_last: on line ...
+Defining \__fp_rand_myriads_last:w on line ...
Defining \__fp_rand_o:Nw on line ...
Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
Defining \__fp_randint_badarg:w on line ...
Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining \__fp_randint_wide_e:nnn on line ...
+Defining \__fp_randint_e:wnn on line ...
+Defining \__fp_randint_e:wwNnn on line ...
+Defining \__fp_randint_e:wwwNnn on line ...
+Defining \__fp_randint_narrow_e:nnnn on line ...
Defining \__fp_randint_wide_e:nnnn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
+Defining \__fp_randint_wide_e:wnnn on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
@@ -5047,7 +5060,7 @@
Defining \__driver_matrix:n on line ...
Defining \l__driver_current_color_tl on line ...
Defining \l__driver_color_stack_int on line ...
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
Defining \__driver_color_ensure_current: on line ...
Defining \__driver_color_reset: on line ...
Defining \__driver_box_use_clip:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4074,14 +4074,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4081,14 +4081,9 @@
Defining \fp_min:nn on line ...
Defining \__fp_array_to_clist:n on line ...
Defining \__fp_array_to_clist_loop:Nw on line ...
+Defining message LaTeX/kernel/fp-no-random on line ...
Defining \__fp_rand_o:Nw on line ...
-Defining \__fp_rand_o: on line ...
Defining \__fp_randint_o:Nw on line ...
-Defining \__fp_randint_badarg:w on line ...
-Defining \__fp_randint_e:w on line ...
-Defining \__fp_randint_narrow_e:nn on line ...
-Defining \__fp_randint_wide_e:nn on line ...
-Defining message LaTeX/kernel/fp-no-random on line ...
Defining \fp_new:N on line ...
Defining \fp_new:c on line ...
Defining \fp_set:Nn on line ...
Modified: trunk/l3kernel/testfiles/m3expl004.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl004.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl004.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -42,6 +42,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -83,6 +86,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3expl004.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl004.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl004.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -41,6 +41,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -82,6 +85,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3expl006.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl006.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl006.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -43,6 +43,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -84,6 +87,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3expl006.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl006.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3expl006.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -42,6 +42,9 @@
\c__fp_Bigg_leading_shift_int=\count130
\c__fp_Bigg_middle_shift_int=\count131
\c__fp_Bigg_trailing_shift_int=\count132
+\c__fp_rand_size_int=\count133
+\c__fp_rand_four_int=\count134
+\c__fp_rand_eight_int=\count135
\c_empty_box=\box56
\l_tmpa_box=\box57
\l_tmpb_box=\box58
@@ -83,6 +86,6 @@
\l__coffin_scaled_total_height_dim=\dimen161
\l__coffin_scaled_width_dim=\dimen162
) (l3pdfmode.def
-\l__driver_color_stack_int=\count133
+\l__driver_color_stack_int=\count136
\l__driver_tmp_box=\box71
))
Modified: trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -79,7 +79,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -88,7 +88,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,7 +97,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -106,7 +106,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -124,7 +124,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -133,7 +133,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -142,7 +142,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(9900000000000000, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -151,7 +151,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(-1e16, -1000000000000000)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -160,7 +160,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -169,7 +169,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, nan)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -178,7 +178,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, inf)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -187,7 +187,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(nan, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -196,7 +196,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(inf, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Modified: trunk/l3kernel/testfiles/m3fp-rand001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3fp-rand001.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -4,40 +4,40 @@
============================================================
TEST 1: Random floating point number
============================================================
-0.2407420072402611
-0.3515320854381432
-0.5533095157403602
-0.0660146332110129
-0.5852169352589155
+0.6462368894354278
+0.9436367545979044
+0.4852789154091621
+0.177206678619497
+0.5709297441167938
============================================================
============================================================
TEST 2: Random integer
============================================================
+2
1
2
-2
-2
1
+1
-9999999999999999
+-9999999999999999
-9999999999999998
--9999999999999998
-9999999999999999
-9999999999999999
-437063568
--666106306
-215291590
-364170477
--276943944
-8769999775679512
-8833715394274005
-38558588213314
-5288608244773258
-8167384417467195
--5008926051050742
--6655967122213220
-7529164776533466
-2488672346419615
-9084896187831551
+444814453
+983095862
+958440641
+448535503
+361158142
+6698906031397161
+4488284872942466
+6862012124606703
+4745501327166187
+9558266238979667
+-8367420653049596
+-616799027378363
+1497734804749083
+6603444483764452
+-9258032600444501
============================================================
============================================================
TEST 3: Random bad arguments
Modified: trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -79,7 +79,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -88,7 +88,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,7 +97,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -106,7 +106,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -124,7 +124,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -133,7 +133,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -142,7 +142,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(9900000000000000, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -151,7 +151,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(-1e16, -1000000000000000)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -160,7 +160,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -169,7 +169,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, nan)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -178,7 +178,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, inf)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -187,7 +187,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(nan, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -196,7 +196,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(inf, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Modified: trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -79,7 +79,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -88,7 +88,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,7 +97,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- rand() expects between 0 and 0 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -106,7 +106,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -124,7 +124,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -133,7 +133,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -142,7 +142,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(9900000000000000, 1e16)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -151,7 +151,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(-1e16, -1000000000000000)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -160,7 +160,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- randint() expects between 1 and 2 arguments.
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -169,7 +169,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, nan)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -178,7 +178,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(1, inf)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -187,7 +187,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(nan, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -196,7 +196,7 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
- Invalid operation randint(inf, 0)
+ Random numbers unavailable
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Modified: trunk/l3kernel/testfiles/m3int001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3int001.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -5,11 +5,11 @@
TEST 1: allocating new registers; no worries
============================================================
Defining \l_testa_int on line ...
-\l_testa_int=\count134
+\l_testa_int=\count137
Defining \g_testa_int on line ...
-\g_testa_int=\count135
+\g_testa_int=\count138
Defining \g_testb_int on line ...
-\g_testb_int=\count136
+\g_testb_int=\count139
============================================================
============================================================
TEST 2: allocating same name: errors expected
@@ -32,10 +32,10 @@
| this name has already been used elsewhere.
|
| The current meaning is:
-| \count134
+| \count137
|...............................................
Defining \l_testa_int on line ...
-\l_testa_int=\count137
+\l_testa_int=\count140
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -54,16 +54,16 @@
| this name has already been used elsewhere.
|
| The current meaning is:
-| \count135
+| \count138
|...............................................
Defining \g_testa_int on line ...
-\g_testa_int=\count138
+\g_testa_int=\count141
============================================================
============================================================
TEST 3: allocate or clear
============================================================
Defining \l_testb_int on line ...
-\l_testb_int=\count139
+\l_testb_int=\count142
0
0
0
Added: trunk/l3kernel/testfiles/m3int001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.ptex.tlg (rev 0)
+++ trunk/l3kernel/testfiles/m3int001.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -0,0 +1,180 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Frank Mittelbach
+============================================================
+TEST 1: allocating new registers; no worries
+============================================================
+Defining \l_testa_int on line ...
+\l_testa_int=\count134
+Defining \g_testa_int on line ...
+\g_testa_int=\count135
+Defining \g_testb_int on line ...
+\g_testb_int=\count136
+============================================================
+============================================================
+TEST 2: allocating same name: errors expected
+============================================================
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \l_testa_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\l_testa_int' but
+| this name has already been used elsewhere.
+|
+| The current meaning is:
+| \count134
+|...............................................
+Defining \l_testa_int on line ...
+\l_testa_int=\count137
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \g_testa_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\g_testa_int' but
+| this name has already been used elsewhere.
+|
+| The current meaning is:
+| \count135
+|...............................................
+Defining \g_testa_int on line ...
+\g_testa_int=\count138
+============================================================
+============================================================
+TEST 3: allocate or clear
+============================================================
+Defining \l_testb_int on line ...
+\l_testb_int=\count139
+0
+0
+0
+0
+10
+0
+0
+0
+============================================================
+============================================================
+TEST 4: incrementing and decrementing: expect 3, -1
+============================================================
+3
+-1
+============================================================
+============================================================
+TEST 5: generating overflow: expect 2147483647, -2147483648, 2147483647
+============================================================
+2147483647
+-2147483648
+2147483647
+============================================================
+============================================================
+TEST 6: incrementing and decrementing: expect -2
+============================================================
+-2
+============================================================
+============================================================
+TEST 7: trying invalid variables: expect errors
+============================================================
+! You can't use `the character -' after \advance.
+\int_decr:N #1->\tex_advance:D #1-
+ \c_one
+l. ... }
+I'm forgetting what you said and not changing anything.
+! Missing $ inserted.
+<inserted text>
+ $
+l. ... }
+I've inserted a begin-math/end-math symbol since I think
+you left one out. Proceed, with fingers crossed.
+LaTeX Font Info: External font `cmex10' loaded for size
+(Font) <7> on input line ....
+LaTeX Font Info: External font `cmex10' loaded for size
+(Font) <5> on input line ....
+! Missing $ inserted.
+<inserted text>
+ $
+l. ... }
+I've inserted something that you may have forgotten.
+(See the <inserted text> above.)
+With luck, this will get me unwedged. But if you
+really didn't forget anything, try typing `2' now; then
+my insertion and my current dilemma will both disappear.
+============================================================
+============================================================
+TEST 8: using num expr
+============================================================
+185
+-30
+24
+-30
+! Arithmetic overflow.
+\int_set:Nn ...1 \__int_eval:w #2\__int_eval_end:
+l. ... }
+I can't evaluate this expression,
+since the result is out of range.
+0
+============================================================
+============================================================
+TEST 9: adding and subtracting
+============================================================
+50
+35
+6
+-19
+============================================================
+============================================================
+TEST 10: converting numbers: 3 i L ix XXI
+============================================================
+3 i L ix XXI
+============================================================
+============================================================
+TEST 11: converting numbers: expect !! !! !! !a!
+============================================================
+!! !! !! !a!
+============================================================
+============================================================
+TEST 12: converting numbers: expect !! !! !! !i!
+============================================================
+!! !! !! !i!
+============================================================
+============================================================
+TEST 13: converting numbers (huge values)
+============================================================
+fxshrxw
+============================================================
+============================================================
+TEST 14: evaluating integer expressions: 10 NO NO YES YES YES
+============================================================
+10 NO NO YES YES YES
+============================================================
+============================================================
+TEST 15: converting from and to base: expect 21 17
+============================================================
+21 17
+============================================================
+============================================================
+TEST 16: Case statements
+============================================================
+YES
+YES
+YES
+============================================================
Property changes on: trunk/l3kernel/testfiles/m3int001.ptex.tlg
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/l3kernel/testfiles/m3int001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int001.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3int001.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -5,11 +5,11 @@
TEST 1: allocating new registers; no worries
============================================================
Defining \l_testa_int on line ...
-\l_testa_int=\count134
+\l_testa_int=\count137
Defining \g_testa_int on line ...
-\g_testa_int=\count135
+\g_testa_int=\count138
Defining \g_testb_int on line ...
-\g_testb_int=\count136
+\g_testb_int=\count139
============================================================
============================================================
TEST 2: allocating same name: errors expected
@@ -32,10 +32,10 @@
| this name has already been used elsewhere.
|
| The current meaning is:
-| \count134
+| \count137
|...............................................
Defining \l_testa_int on line ...
-\l_testa_int=\count137
+\l_testa_int=\count140
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -54,16 +54,16 @@
| this name has already been used elsewhere.
|
| The current meaning is:
-| \count135
+| \count138
|...............................................
Defining \g_testa_int on line ...
-\g_testa_int=\count138
+\g_testa_int=\count141
============================================================
============================================================
TEST 3: allocate or clear
============================================================
Defining \l_testb_int on line ...
-\l_testb_int=\count139
+\l_testb_int=\count142
0
0
0
Modified: trunk/l3kernel/testfiles/m3int002.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.luatex.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3int002.luatex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -164,19 +164,19 @@
TEST 14: Integer creation
============================================================
Defining \l_A_int on line ...
-\l_A_int=\count135
+\l_A_int=\count138
Defining \g_A_int on line ...
-\g_A_int=\count136
-\count135
-\count136
+\g_A_int=\count139
+\count138
+\count139
Defining \l_B_int on line ...
-\l_B_int=\count137
+\l_B_int=\count140
Defining \g_B_int on line ...
-\g_B_int=\count138
-\count137
-\count138
-\count137
-\count138
+\g_B_int=\count141
+\count140
+\count141
+\count140
+\count141
============================================================
============================================================
TEST 15: Integer creation errors
@@ -199,10 +199,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count135
+| \count138
|...............................................
Defining \l_A_int on line ...
-\l_A_int=\count139
+\l_A_int=\count142
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -221,10 +221,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count136
+| \count139
|...............................................
Defining \g_A_int on line ...
-\g_A_int=\count140
+\g_A_int=\count143
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -243,10 +243,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count137
+| \count140
|...............................................
Defining \l_B_int on line ...
-\l_B_int=\count141
+\l_B_int=\count144
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -265,10 +265,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count138
+| \count141
|...............................................
Defining \g_B_int on line ...
-\g_B_int=\count142
+\g_B_int=\count145
============================================================
============================================================
TEST 16: Constant integer creation
@@ -277,10 +277,10 @@
\char"5
5
Defining \c_B_int on line ...
-\c_B_int=\count143
-\count143
+\c_B_int=\count146
+\count146
-10
-\count143
+\count146
-10
============================================================
============================================================
@@ -325,10 +325,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count143
+| \count146
|...............................................
Defining \c_B_int on line ...
-\c_B_int=\count144
+\c_B_int=\count147
============================================================
============================================================
TEST 18: Set integers equal
Added: trunk/l3kernel/testfiles/m3int002.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.ptex.tlg (rev 0)
+++ trunk/l3kernel/testfiles/m3int002.ptex.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -0,0 +1,702 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: LaTeX3 Project
+============================================================
+TEST 1: Comparing integer values as predicates
+============================================================
+FALSE
+TRUE
+TRUE
+FALSE
+============================================================
+============================================================
+TEST 2: Comparing integer values
+============================================================
+FALSE
+TRUE
+TRUE
+FALSE
+TRUE
+TRUE
+FALSE
+FALSE
+============================================================
+============================================================
+TEST 3: Integer tests: if even as predicates
+============================================================
+FALSE
+TRUE
+TRUE
+FALSE
+============================================================
+============================================================
+TEST 4: Integer tests: if even
+============================================================
+FALSE
+TRUE
+TRUE
+FALSE
+TRUE
+TRUE
+FALSE
+FALSE
+============================================================
+============================================================
+TEST 5: Integer tests: if odd as predicates
+============================================================
+TRUE
+FALSE
+FALSE
+TRUE
+============================================================
+============================================================
+TEST 6: Integer tests: if odd
+============================================================
+TRUE
+FALSE
+FALSE
+TRUE
+TRUE
+TRUE
+FALSE
+FALSE
+============================================================
+============================================================
+TEST 7: Integer while-do and do-while
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
+============================================================
+============================================================
+[10]
+============================================================
+============================================================
+TEST 8: Integer until-do and do-until
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
+============================================================
+[10]
+============================================================
+[10]
+============================================================
+============================================================
+TEST 9: Evaluating integer expressions
+============================================================
+10
+10
+22
+============================================================
+============================================================
+TEST 10: Absolute value for integers
+============================================================
+0
+10
+10
+40
+15
+45
+============================================================
+============================================================
+TEST 11: Integer division: truncation
+============================================================
+2
+2
+1
+-2
+-2
+-1
+-2
+-2
+-1
+2
+2
+1
+1
+-1
+0
+1
+2
+-1
+-2
+-1
+-2
+1
+2
+============================================================
+============================================================
+TEST 12: Maximum and minimum integers
+============================================================
+11
+7
+-7
+7
+7
+-7
+1
+7
+-11
+-11
+7
+-7
+-7
+-999
+============================================================
+============================================================
+TEST 13: Integer division: modulo
+============================================================
+0
+4
+4
+0
+-4
+-4
+0
+4
+4
+0
+-4
+-4
+============================================================
+============================================================
+TEST 14: Integer creation
+============================================================
+Defining \l_A_int on line ...
+\l_A_int=\count135
+Defining \g_A_int on line ...
+\g_A_int=\count136
+\count135
+\count136
+Defining \l_B_int on line ...
+\l_B_int=\count137
+Defining \g_B_int on line ...
+\g_B_int=\count138
+\count137
+\count138
+\count137
+\count138
+============================================================
+============================================================
+TEST 15: Integer creation errors
+============================================================
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \l_A_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\l_A_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \count135
+|...............................................
+Defining \l_A_int on line ...
+\l_A_int=\count139
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \g_A_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\g_A_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \count136
+|...............................................
+Defining \g_A_int on line ...
+\g_A_int=\count140
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \l_B_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\l_B_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \count137
+|...............................................
+Defining \l_B_int on line ...
+\l_B_int=\count141
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \g_B_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\g_B_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \count138
+|...............................................
+Defining \g_B_int on line ...
+\g_B_int=\count142
+============================================================
+============================================================
+TEST 16: Constant integer creation
+============================================================
+Defining \c_A_int on line ...
+\mathchar"5
+5
+Defining \c_B_int on line ...
+\c_B_int=\count143
+\count143
+-10
+\count143
+-10
+============================================================
+============================================================
+TEST 17: Constant integer creation errors
+============================================================
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \c_A_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\c_A_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \mathchar"5
+|...............................................
+Defining \c_A_int on line ...
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/command-already-defined"
+!
+! Control sequence \c_B_int already defined.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| LaTeX has been asked to create a new control sequence '\c_B_int' but this
+| name has already been used elsewhere.
+|
+| The current meaning is:
+| \count143
+|...............................................
+Defining \c_B_int on line ...
+\c_B_int=\count144
+============================================================
+============================================================
+TEST 18: Set integers equal
+============================================================
+4
+0
+4
+0
+4
+0
+4
+0
+============================================================
+============================================================
+TEST 19: Set integers equal globally
+============================================================
+4
+4
+4
+4
+4
+4
+4
+4
+============================================================
+============================================================
+TEST 20: Add to integers
+============================================================
+8
+-2
+0
+8
+-2
+0
+============================================================
+============================================================
+TEST 21: Add to integers globally
+============================================================
+8
+-2
+-2
+6
+-4
+-4
+============================================================
+============================================================
+TEST 22: Decreasing integers
+============================================================
+-1
+-2
+0
+-1
+-2
+0
+============================================================
+============================================================
+TEST 23: Decreasing integers globally
+============================================================
+-1
+-2
+-2
+-3
+-4
+-4
+============================================================
+============================================================
+TEST 24: Increasing integers
+============================================================
+1
+2
+0
+1
+2
+0
+============================================================
+============================================================
+TEST 25: Increasing integers globally
+============================================================
+1
+2
+2
+3
+4
+4
+============================================================
+============================================================
+TEST 26: Setting integers to arbitrary values
+============================================================
+0
+2147483647
+-2147483647
+330
+0
+0
+2147483647
+-2147483647
+330
+0
+============================================================
+============================================================
+TEST 27: Setting integers to arbitrary values globally
+============================================================
+0
+2147483647
+-2147483647
+330
+330
+0
+2147483647
+-2147483647
+330
+330
+============================================================
+============================================================
+TEST 28: Subtract from integers
+============================================================
+-8
+2
+0
+-8
+2
+0
+============================================================
+============================================================
+TEST 29: Subtract from integers globally
+============================================================
+-8
+2
+2
+-6
+4
+4
+============================================================
+============================================================
+TEST 30: Zeroing integers
+============================================================
+0
+1234
+0
+1234
+============================================================
+============================================================
+TEST 31: Zeroing integers globally
+============================================================
+0
+0
+0
+0
+============================================================
+============================================================
+TEST 32: Integer variable overflows
+============================================================
+-2147483648
+2147483647
+============================================================
+============================================================
+TEST 33: Showing integers
+============================================================
+> \l_A_int=123.
+<recently read> }
+l. ...}
+> \l_A_int=123.
+<recently read> }
+l. ...}
+> 123+2*\l_A_int =369.
+<recently read> }
+l. ...}
+============================================================
+============================================================
+TEST 34: Using integers
+============================================================
+123
+678
+============================================================
+============================================================
+TEST 35: Integer conversion to Arabic
+============================================================
+! Missing number, treated as zero.
+<to be read again>
+ a
+l. ...}
+A number should have been here; I inserted `0'.
+(If you can't figure out why I needed to see a number,
+look up `weird error' in the index to The TeXbook.)
+0
+2
+12
+3
+[0a\__int_eval_end: ]
+============================================================
+============================================================
+TEST 36: Integer conversion to alph
+============================================================
+[]
+b
+l
+cu
+[]
+fxshrxw
+[]
+B
+L
+CU
+[]
+FXSHRXW
+============================================================
+============================================================
+TEST 37: Integer conversion to binary
+============================================================
+0
+10
+1100
+1100011
+-100
+1111111111111111111111111111111
+============================================================
+============================================================
+TEST 38: Integer conversion to hexadecimal
+============================================================
+0
+2
+c
+63
+-4
+-63
+7fffffff
+0
+2
+C
+63
+-4
+-63
+7FFFFFFF
+============================================================
+============================================================
+TEST 39: Integer conversion to octal
+============================================================
+0
+2
+14
+143
+-4
+-143
+17777777777
+============================================================
+============================================================
+TEST 40: Integer conversion to Roman numerals
+============================================================
+[]
+ii
+xii
+xcix
+[]
+[]
+II
+XII
+XCIX
+[]
+============================================================
+============================================================
+TEST 41: Integers from alph
+============================================================
+26
+731
+26
+731
+731
+============================================================
+============================================================
+TEST 42: Integers from binary
+============================================================
+21
+31
+-26
+============================================================
+============================================================
+TEST 43: Integers from hexadecimal
+============================================================
+217059
+16777215
+74565
+-53
+============================================================
+============================================================
+TEST 44: Integers from octal
+============================================================
+227
+5349
+-29
+============================================================
+============================================================
+TEST 45: Integers from Roman numerals
+============================================================
+1992
+3391
+4
+17
+============================================================
+============================================================
+TEST 46: Conversion of an integer to an arbitrary base
+============================================================
+234
+121
+-20
+1a
+234
+121
+-20
+1A
+============================================================
+============================================================
+TEST 47: Conversion of an integer from an arbitrary base
+============================================================
+66
+81
+-5
+210
+============================================================
+============================================================
+TEST 48: Public integer constants
+============================================================
+2147483647
+============================================================
+============================================================
+TEST 49: Internal integer constants
+============================================================
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+32
+100
+255
+256
+1000
+10000
+============================================================
+============================================================
+TEST 50: Integer while-do and do-while
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
+============================================================
+============================================================
+[10]
+============================================================
+============================================================
+TEST 51: Integer until-do and do-until
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
+============================================================
+[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
+============================================================
+[10]
+============================================================
+[10]
+============================================================
Property changes on: trunk/l3kernel/testfiles/m3int002.ptex.tlg
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/l3kernel/testfiles/m3int002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3int002.tlg 2016-12-05 17:04:46 UTC (rev 6784)
+++ trunk/l3kernel/testfiles/m3int002.tlg 2016-12-06 05:49:48 UTC (rev 6785)
@@ -164,19 +164,19 @@
TEST 14: Integer creation
============================================================
Defining \l_A_int on line ...
-\l_A_int=\count135
+\l_A_int=\count138
Defining \g_A_int on line ...
-\g_A_int=\count136
-\count135
-\count136
+\g_A_int=\count139
+\count138
+\count139
Defining \l_B_int on line ...
-\l_B_int=\count137
+\l_B_int=\count140
Defining \g_B_int on line ...
-\g_B_int=\count138
-\count137
-\count138
-\count137
-\count138
+\g_B_int=\count141
+\count140
+\count141
+\count140
+\count141
============================================================
============================================================
TEST 15: Integer creation errors
@@ -199,10 +199,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count135
+| \count138
|...............................................
Defining \l_A_int on line ...
-\l_A_int=\count139
+\l_A_int=\count142
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -221,10 +221,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count136
+| \count139
|...............................................
Defining \g_A_int on line ...
-\g_A_int=\count140
+\g_A_int=\count143
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -243,10 +243,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count137
+| \count140
|...............................................
Defining \l_B_int on line ...
-\l_B_int=\count141
+\l_B_int=\count144
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
@@ -265,10 +265,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count138
+| \count141
|...............................................
Defining \g_B_int on line ...
-\g_B_int=\count142
+\g_B_int=\count145
============================================================
============================================================
TEST 16: Constant integer creation
@@ -277,10 +277,10 @@
\mathchar"5
5
Defining \c_B_int on line ...
-\c_B_int=\count143
-\count143
+\c_B_int=\count146
+\count146
-10
-\count143
+\count146
-10
============================================================
============================================================
@@ -325,10 +325,10 @@
| name has already been used elsewhere.
|
| The current meaning is:
-| \count143
+| \count146
|...............................................
Defining \c_B_int on line ...
-\c_B_int=\count144
+\c_B_int=\count147
============================================================
============================================================
TEST 18: Set integers equal
More information about the latex3-commits
mailing list