CTAN Comprehensive TeX Archive Network

Directory macros/latex/contrib/bnumexpr


Source: bnumexpr.dtx Version: v1.5, 2021/05/17 (doc: 2021/05/17) Author: Jean-Francois Burnol Info: Expressions with big integers License: LPPL 1.3c

bnumexpr usage

The package bnumexpr allows expandable computations with integers and the four infix operators +, -, *, / using the expression syntax familiar from the \numexpr parser, with these extensions:

  • arbitrarily big integers,
  • floored division //,
  • associated modulo /:,
  • power operators ^ and **,
  • factorial post-fix operator !,
  • comma separated expressions,
  • the space character as well as the underscore may serve to separate groups of digits,
  • optional conversion of output to hexadecimal,
  • customizability and extendibility of the syntax.

The expression parser is a scaled-down variant from the \xintiiexpr...\relax parser from package xintexpr.

To support hexadecimal input and output, the package xintbinhex is loaded automatically.

The package loads by default xintcore but the option custom together with macro \bnumexprsetup allow to map the syntax elements to macros from an alternative big integer expandable engine of the user own choosing, and then xintcore is not loaded.


Use your installation manager to install or update bnumexpr.

Else, obtain bnumexpr.dtx, from CTAN:


Run "etex bnumexpr.dtx" to extract these files:

bnumexpr.sty : this is the style file.


bnumexprchanges.tex : change history.

bnumexpr.tex : can be used to generate the documentation

To generate the documentation:

  • with latex+dvipdfmx: "latex bnumexpr.tex" (thrice) then "dvipdfmx bnumexpr.dvi".
  • with pdflatex: "pdflatex bnumexpr.tex" (thrice).

In both cases files README.md and bnumexprchanges.tex must be located in the same repertory as bnumexpr.tex and bnumexpr.dtx.

Without bnumexpr.tex:

  • "pdflatex bnumexpr.dtx" (thrice) extracts all files and simultaneously generates the pdf documentation.

Final steps:

  • move files to appropriate destination:
       bnumexpr.sty   --> TDS:tex/latex/bnumexpr/
       bnumexpr.dtx   --> TDS:source/latex/bnumexpr/
       bnumexpr.pdf   --> TDS:doc/latex/bnumexpr/
          README.me   --> TDS:doc/latex/bnumexpr/
  • discard auxiliary files generated during compilation.


Copyright (C) 2014-2021 by Jean-Francois Burnol

This Work may be distributed and/or modified under the conditions of the Project Public License 1.3c. This version of this license is in


and version 1.3 or later is part of all distributions of version 2005/12/01 or later.

This Work has the LPPL maintenance status "author-maintained".

The Author and Maintainer of this Work is Jean-Francois Burnol.

This Work consists of the main source file and its derived files

bnumexpr.dtx, bnumexpr.sty, bnumexpr.pdf, bnumexpr.tex,
bnumexprchanges.tex, README.md

Download the contents of this package in one zip archive (150.8k).

bnumexpr – Extends ’s \numexpr...\relax construct to big integers

The package extends ε- \numexpr...\relax operation to allow big integers, powers, factorials, truncated division and its associated modulo.

By default, bnumexpr loads package xintcore (part of the xint bundle) and uses its arithmetic macros.

Version1.5 2021-05-17
LicensesThe Project Public License 1.3c
Copyright2014–2021 Jean-François Burnol
MaintainerJean-François Burnol
Contained inTeX Live as bnumexpr
MiKTeX as bnumexpr
Guest Book Sitemap Contact Contact Author