I creat me a newcommand that use calculator packages. It is for a cross-multiplication, basically to pass units.

The newcommand say:

        \SI{#1}{#2} & \text{\line(1,0){40}}\SI{#3}{#4}\\
        \SI{#5}{#6} & \text{\line(1,0){40}}x=\frac{\SI{#5}{\cancel#6}\cdot\SI{#3}{#4}}{\SI{#1}{\cancel#2}}=\SI{\resultado}{#4}

work fine when the numbers are minor that 15999, but when multiply 15999x15999 fail or when the numbers (any) mayor that 15999.

How can I do to use great number? In the deep, not more great only 101325. The problem I think that not is siunitx package, because I use bigger numbers without problem.

Thanks a lot!


  • you can use \fpeval: \qty{\fpeval{159999*159999}}{Hz}. Commented Apr 1, 2023 at 20:52

2 Answers 2


First: the \SI macro in siunitx is obsolete and should be replaced with \qty.

Second, for such a use case you should probably use the LuaLaTeX compiler, so that you can make the computations in Lua and have them printed in LaTeX.


    a = 15999
    b = 15999
    c = 1e8
    d = 3.4e12

First ratio : \qty{\directlua{tex.print(a/b)}}{m}

Second ratio : \qty{\directlua{tex.print(c/d)}}{Hz}


As you can see, everything you type in the \directlua macro is Lua code. Then, inside the Lua code, the tex.print function sends the value of its argument to LaTeX.

Also, if you have several \directlua macros, they are treated as part of the same block of code, so you can reuse variables from one to the other.

If you want to format the numbers, you can do it in Lua using the usual string-formatting functions before sending them back to LaTeX.


Well, the problem not is a problem. The calculator package can not operate with numbers more bigs that 2^14. The documentation, section 13.1 say thus:

The largest TeX number is 16383.99998 ≈ 214 ; \cctr@logmaxnum is the logarithm of this num-
ber, 9.704 ≈ log 16384.

Meanwhile I wait for the new Debian's upgrade for use the new packages. Because somethings like nicematrix and siunitx are old (2020).

Thanks a lot!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .