CTAN Comprehensive TeX Archive Network

Directory macros/generic/xint

README.md

% README % xint 1.4o % 2025/09/06

Source:  xint.dtx 1.4o 2025/09/06 (doc 2025/09/06)
Author:  Jean-François Burnol
Info:    Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c

Description

The main functionality is \xintfloateval which parses expressions involving floating point numbers, functions, variables and other syntax elements.

The precision defaults to 16 decimal digits. The logarithm, exponential, direct and inverse trigonometric functions are supported up to 62 digits. The four basic operations and square-root extraction are implemented with correct rounding up to thousands of digits (roughly up to a maximum of 26000 digits for the output).

A variant \xinteval computes with fractions. And \xintiieval handles only (arbitarily large) integers.

All three parsers obtain their result purely expandably. They handle comma separated inputs and nested structures using square brackets. The user can declare custom variables and functions.

Usage

The way of loading xintexpr depends on whether you are using LaTeX or not.

  • with LaTeX, add \usepackage{xintexpr} to the document preamble,
  • else, do \input xintexpr.sty and compile with either one of etex, pdftex, xetex, luatex (they all default to the Plain TeX format), or with optex (i.e. luatex with OpTeX format), or with context (luametatex engine).

Example

Here is an example typical of the xintexpr users morning routine since many years (xintexpr was first released in 2013):

\xinteval{reduce(add(1/i^3, i=1..25))}

It expands (in two steps) to:

2560976152652211536408111110189/2131858131361319942957376000000

Repository

It is at https://github.com/jfbu/xint and the issue tracker is at https://github.com/jfbu/xint/issues.

Documentation

Both the user manual and the commented source code are in xint.pdf.

A file CHANGES.html is provided at https://jfbu.github.io/xint. Its source xintchanges.md is part of the CTAN upload, and you can access it in Live using texdoc xintchanges.md.

License

Copyright © 2013-2022, 2025 Jean-François 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

http://www.latex-project.org/lppl/lppl-1-3c.txt

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-François Burnol.

This Work consists of the file xint.dtx and README.md and their derived files such as xint.pdf.

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

xint – Expandable arbitrary precision floating point and integer operations

Loading xintexpr provides \xinteval and \xintfloateval.

\xintfloateval evaluates numerical expressions. The floating point precision defaults to 16 decimal digits and can be set by user. Trigonometry, exponential and logarithms are implemented up to a maximal precision of 62 decimal digits.

\xinteval computes exactly with integers, fractions, and decimal numbers or numbers in scientific notation. Note though that multiplying two floating point numbers will about double the number of digits, and so on, because the algebra is done exactly.

Both are compatible with expansion-only context.

Loading xintexpr imports automatically various other modules that it depends upon. Among them:

  • xinttools: utilities such as expandable and non-expandable loops,
  • xint: macros implementing in particular the basic operations on arbitrarily long integers,
  • xintbinhex: conversions between decimal and binary, octal, or hexadecimal bases for arbitrarily long integers,
  • xintfrac: macros implementing in particular the basic operations on arbitrarily large fractions, decimal numbers, or numbers in scientific notation.

Further modules of independent interest include xintgcd, xintseries and xintcfrac.

You can use xintexpr (and the other components) with (via \usepackage) or also with Plain , Op, or Cont (via \input xintexpr.sty).

All the components are documented in the file xint.pdf, which also contains the commented source code.

Packagexint
Home pagehttps://jfbu.github.io/xint
Bug trackerhttps://github.com/jfbu/xint/issues
Repositoryhttps://github.com/jfbu/xint
Version1.4o 2025-09-06
LicensesThe Project Public License 1.3c
Copyright2013–2022, 2025 Jean-François Burnol
MaintainerJean-François Burnol
TDS archivexint.tds.zip
Contained inTeX Live as xint
MiKTeX as xint
TopicsCalculation
Arithmetic
...
Guest Book Sitemap Contact Contact Author