Index of /macros/generic/xint

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[TXT]CHANGES.html18-May-2018 23:43 84K 
[   ]CHANGES.pdf18-May-2018 23:43 97K 
[TXT]Makefile29-Feb-2016 15:24 655  
[   ]sourcexint.pdf18-May-2018 23:43 683K 
[TXT]xint.dtx18-May-2018 23:42 1.4M 
[TXT]xint.ins18-May-2018 23:42 2.9K 
[   ]xint.pdf18-May-2018 23:42 818K 

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

This README is also available as README.pdf and README.html.

Change log is to be found in CHANGES.pdf or CHANGES.html.

The user manual is xint.pdf, and the commented source code is available as sourcexint.pdf.


The basic aim is provide expandable computations on integers, fractions, and floating point numbers. For example

\xinttheexpr reduce(37189719/183618963+11390170/17310720)^17\relax

will evaluate exactly the fraction; the result has 462 characters (including the fraction slash.) One can also work with dummy variables:

\xinttheexpr mul(add(x(x+1)(x+2), x=y..y+15), y=171286,98762,9296)\relax

evaluates to 15979066346135829902328007959448563667099190784.

Float computations are possible at an adjustable precision (default 16).

\xintDigits:=48;\xintthefloatexpr 123_456_789^1_000.5\relax

But currently, only integer and half-integer exponents are allowed for the power operation in expressions and only the square-root operation is implemented besides the four arithmetic operations. Square-root and the four operations achieve correct rounding in the given arbitrary precision.

Sub-units xintcore, xint and xintfrac provide the underlying macros, and xintexpr loads all of them and provides expandable parsers allowing computations such as the above (and more).


It is possible to use the package with Plain (via \input anywhere) or with LaTeX (via \usepackage in the preamble).

With LaTeX

\usepackage{xint}       % expandable arithmetic with big integers
\usepackage{xintfrac}   % decimal numbers, fractions, floats
\usepackage{xintexpr}   % expressions with infix operators

Further packages: xintbinhex, xintgcd, xintseries and xintcfrac.

Main dependencies are handled automatically. For example xintexpr automatically loads xintfrac which itself loads xint; but use of the gcd and lcm functions in expressions require explicit loading of xintgcd, and hexadecimal notation requires explicit loading of xintbinhex.

Package xintcore is the subset of xint providing only the five operations on big integers: \xintiiAdd, \xintiiMul, ... It is (by default) loaded by the (LaTeX only) package bnumexpr which provides a more light-weight expression parser handling only big integers, the four operations, the power operation and the factorial.

There is also xinttools which is a separate package providing, among others, expandable and non-expandable loops such as \xintFor.

With TeX

One does for example:

\input xintexpr.sty

The packages may be loaded in any catcode context such that letters, digits, \ and % have their standard catcodes.

xintcore.sty and xinttools.sty both import xintkernel.sty which has the catcode handler and package identifier and defines a few utilities such as \oodef, \fdef, or \xint_dothis/\xint_orthat.


Method A: using the package manager of your TeX distribution

xint is included in TeXLive (hence also MacTeX) and MikTeX.

There can be a few days of delay between apparition of a new version on CTAN and availability via the distribution package manager.

Method B: manual installation using and unzip

Assumes a GNU/Linux-like system (or Mac OS X).

  1. obtain from CTAN:

  2. cd to the download repertory and issue:

    unzip -d <TEXMF>

    where <TEXMF> is a suitable TDS-compliant destination repertory. For example, with TeXLive:

Method C: manual installation using Makefile and xint.dtx

The Makefile automatizes rebuilding from xint.dtx all documentation files as well as It is for GNU/Linux-like (inc. Mac OS X) systems, with a teTeX like installation such as TeXLive. Furthermore the Pandoc software is required.

  1. obtain xint.dtx and Makefile from

  2. put them in an otherwise empty working repertory, run make or equivalently make help for further instructions.

Method D: installation starting with only xint.dtx

Run "tex xint.dtx" or "etex xint.dtx" to extract from xint.dtx all packages as well as these files:
the current README with Markdown formatting.
the changes across successive releases.
used to generate xint.pdf via "latex xint.tex" (thrice) then "dvipdfmx xint.dvi". It is also possible to compile xint.tex with xelatex, or with pdflatex (this latter option produces a bigger pdf).

For successful compilation, packages newtxtt, newtxmath, etoc, mathastext are needed. Inclusion of the source code is off by default, but the toggle can be set in xint.tex.

A third option is to generate xint.pdf via xelatex xint.dtx or pdflatex xint.dtx. Source code is then included by default (but some code comments in French use 8bit characters, hence for xelatex an a priori conversion of xint.dtx into utf-8 will give a better result).
this is for UNIX-like systems. Note: this file is only produced with "etex xint.dtx", not with "tex xint.dtx". Rename it to Makefile and run make on the command line for further help. and
these are scripts (for UNIX-like systems) which can be used to convert the and to HTML and PDF formats. They require Pandoc.
a Pandoc template used by

Finishing the installation in a TDS hierarchy:

Depending on the destination, it may then be necessary to refresh a filename database.


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

This Work may be distributed and/or modified under the conditions of the LaTeX 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 LaTeX 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 source file xint.dtx and of its derived files: xintkernel.sty, xintcore.sty, xint.sty, xintfrac.sty, xintexpr.sty, xintbinhex.sty, xintgcd.sty, xintseries.sty, xintcfrac.sty, xinttools.sty, xint.ins, xint.tex, README,, README.html, README.pdf,, CHANGES.html, CHANGES.pdf, pandoctpl.latex,,, xint.dvi, xint.pdf,