The L3fp package proposes the range of randint
parameters to be +- 10^16 - 1
; yet, I seem to be restricted to +-2^31 - 1
, any value above it produces the Number too big
compilation error. On the other hand I am getting the expected full 16-decimal digit accuracy for fp
values. Why?
\documentclass{article}
% RN. 15 April 2017
% BRIEF DESCRIPTION:
%=======================
\usepackage[check-declarations]{expl3}
\usepackage{xparse}
%-----------------------
\ExplSyntaxOn
\int_new:N \l_rn_someInteger_int
\fp_new:N \l_rn_someFp_fp
\NewDocumentCommand\mySetInteger{m}
{
\int_set:Nn \l_rn_someInteger_int {#1}
some~integer:~\int_use:N \l_rn_someInteger_int\\
\int_set:Nn \l_rn_someInteger_int {\fp_eval:n {randint(#1)}}
some~random~integer:~\int_use:N \l_rn_someInteger_int\\
\fp_set:Nn \l_rn_someFp_fp {\fp_eval:n {rand()}}
some~random~real:~\fp_use:N \l_rn_someFp_fp\\
-------------------------------------------\\
}
\ExplSyntaxOff
%-----------------------
\begin{document}
\mySetInteger{1234}
\mySetInteger{2147483647}
% \mySetInteger{2147483648}
% \mySetInteger{9999999999999999}
\end{document}
+- 10^16 - 1
as parameters for theL3fp randint()
function, and that questions had been answered by @egreg: use thexfp
package and operate withfp
variables rather than withint
s.