CTAN Comprehensive TeX Archive Network

Directory macros/generic/xint


% README % xint 1.4b % 2020/02/25

Source:  xint.dtx 1.4b 2020/02/25 (doc 2020/02/25)
Author:  Jean-Francois Burnol
Info:    Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c

Aim and usage

It is possible to use the package both with Plain (\input xintexpr.sty) or with the macro format (\usepackage{xintexpr}).

The basic aim is provide expandable computations on (arbitrily big) integers, fractions, and floating point numbers (at a user chosen precision). The four operations and the square-root extraction achieve so-called correct rounding for the given arbitrary precision.

The syntax knows dummy variables, as in this example:

\xinteval{reduce(add(x/(x+7), x = 1000..1010))}

which expands to:


Trigonometrical functions are available:

\xintfloateval{[-2] sind(37)}

expands to:


The -2 means to round the result to 2 digits less than float precision: currently trigonometrical functions are mostly implemented at high level via the user interface for declaring functions and variables and have no way to use guard digits, hence the last two digits are often not accurate.

Release 1.4 adds support for nested structures. For example:

\xintthealign\xintexpr ndseq(1/(i+j), i=1..5; j=1..5)\relax

will print on the page (this is customizable, e.g. to use a pmatrix environnement rather):

[[ 1/2, 1/3, 1/4, 1/5, 1/6  ],
 [ 1/3, 1/4, 1/5, 1/6, 1/7  ],
 [ 1/4, 1/5, 1/6, 1/7, 1/8  ],
 [ 1/5, 1/6, 1/7, 1/8, 1/9  ],
 [ 1/6, 1/7, 1/8, 1/9, 1/10 ]]

It is possible to declare "universal functions" (à la NumPy) which will act itemwise on all leaves of such "arrays". More features are planned such as providing an interface to algebra of matrices in this framework.


xint is included in Live (hence Mac also) and in Mik. Thus, use the package manager to update your distribution.


  • download xint.tds.zip and install in a suitable TDS-compliant repertory via unzip. "admin" privilges might be needed, as well as a file database rebuild (texhash). For example, on macos x, installation into user home folder (no sudo, and no texhash as it is recommended to not have a ls-R file there)
    unzip xint.tds.zip -d  ~/Library/texmf
  • all files can be extracted using etex xint.dtx, or make if the Makefile included in the CTAN upload is present; see the file INSTALL, if present, else read the help in extracted file Makefile.mk.


README.md: this file

CHANGES.html: change log as relevant to end users (texdoc --list xint)

xint.pdf: user manual

sourcexint.pdf: commented source code (texdoc --list xint or texdoc sourcexint)


Since release 1.4, xintexpr requires the \expanded primitive. This is a functionality of all major engines since Live 2019.


Copyright (C) 2013-2020 by Jean-Francois Burnol

This Work may be distributed and/or modified under the conditions of the Project Public License version 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 of this Work is Jean-Francois Burnol.

This Work consists of the files Makefile, INSTALL, and xint.dtx and its extracted and derived files inclusive of the documentation files xint.pdf, sourcexint.pdf and CHANGES.html.

See xint.pdf for contact information.

Download the contents of this package in one zip archive (2.3M).

xint – Expandable operations on long numbers

The xint bundle main modules are:

utilities of independent interest such as expandable and non-expandable loops,
expandable macros implementing addition, subtraction, multiplication, division, and powers for arbitrarily long integers,
extension of xintcore,
extends the scope of xint to decimal numbers, to numbers using scientific notation and also to (exact) fractions,
provides expandable parsers of numeric expressions using the standard infix notations, parentheses, built-in functions, user definable functions and variables (and more ...) which do either exact evaluations (also with fractions) or floating point evaluations under a user chosen precision.

Further modules of the bundle are: xintkernel (support macros for all the bundle constituents), xintbinhex (conversion to and from hexadecimal and binary bases), xintgcd (provides gcd() and lcm() functions to xintexpr), xintseries (evaluates numerically partial sums of series and power series with fractional coefficients), and xintcfrac (dedicated to the computation and display of continued fractions).

All computations are compatible with expansion-only context.

The packages may be used with Plain , , or (a priori) any other macro format built upon .

Version1.4b 2020-02-25
LicensesThe Project Public License 1.3c
Copyright2013–2020 Jean-François Burnol
MaintainerJean-François Burnol
TDS archivexint.tds.zip
Contained inTeX Live as xint
MiKTeX as xint
Guest Book Sitemap Contact Contact Author