Extension:BCmath

BCmath provides arbitrary-precision arithmetic to 2>Special:MyLanguage/Help:Lua|Lua modules.

With the lib from this extension it would be completely valid to do calculations on 𝜋 with 125 characters, 𝜋 ≅ 3,141 592 653 589 793 238 462 643 383 279 502 884 197 169 399 375 105 820 974 944 592 307 816 406 286 208 998 628 034 825 342 117 067 982 148 086 513 282 306 647 093 8… (Actually, the real 𝜋 is even infinitely much longer!)

The extension uses PHP [https://www.php.net/book.bc BCMath Arbitrary Precision Mathematics] api through use of phpseclib/bcmath_compat to access the bc programming language.

Installation
Expect depends on modules from the  extension.

Usage
The workflow is to first define a BCmath instance, and then use that in ordinary equations, in chained operations, or as part of function calls.

Existence of an instance in supported operations will trigger use of the special functions and methods.

For further help, see the generated LDoc documentation.

Development
For recreating the Vagrant-based development environment, see BCmath: Topics/Vagrant.

Alternatives
The best and perhaps only real alternative is the decNumber C-library, which implements IEEE 754r, and the ldecNumber Lua wrapper library for interfacing with decNumber.

These two must be used together.
 * decNumber (C-library)
 * The decNumber Library
 * GitHub: gcc-mirror/libdecnumber
 * ldecNumber (Lua-library)
 * LuaForge: Lua decNumber
 * Ldocnumber documentation

The decNumber library should have a security audit before it is used, but it is probably safe.

The Lua library is archived, and is hopelessly outdated with a last version (ldecNumber-21) from August 2007.

There are no known MediaWiki-integration for decNumber/ldecNumber.