Movatterモバイル変換
[0]ホーム
LibBF Library
News
- 2025-06-03: New version with the BFCalc calculator application (web version).
Introduction
LibBF is a small library to handle arbitrary precision floating pointnumbers. Its compiled size is about 90 KB of x86 code and has nodependency on other libraries. It is not the fastest library nor thesmallest but it tries to be simple while using asymptotically optimalalgorithms. The basic arithmetic operations have a near linear runningtime.
The BFCalc example is a calculator application with a Javascript likesyntax. It supports arbitrarily large integers, decimal and binaryarbitrary precision floating point numbers, multi-dimensional arrays(matrices and tensors), polynomials, series, unit conversion.
Features:- Arbitrary precision floating point numbers in base 2 usingtheIEEE 754semantics (including subnormal numbers, infinities and NaN).
- All operations are exactly rounded using the 5 IEEE 754 rounding modes (round to nearest with ties to even or away from zero, round to zero, -/+ infinity). The additional non-deterministic faithful rounding mode is supported when a lower or deterministic running time is necessary.
- Stateless API (each function takes as input the rounding mode, mantissa and exponent precisions in bits and return the IEEE status flags).
- The basic arithmetic operations (addition, subtraction, multiplication, division, square root) have a near linear running time.
- Multiplication using a SIMD optimized Number Theoretic Transform.
- Exactly rounded floating point input and output in any base between 2 and 36 with near linear runnning time. Floating point output can select the smallest amount of digits to get the required precision.
- Transcendental functions are supported (exp, log, pow, sin, cos, tan, asin, acos, atan, atan2).
- Operations on arbitrarily large integers are supported by using a special "infinite" precision. Integer division with remainder and logical operations (assuming two complement binary representation) are implemented.
- Arbitrary precision floating point numbers in base 10 corresponding to the IEEE 754 2008 semantics with the limitation that the mantissa is always normalized. The basic arithmetic operations, output and input are supported with a quadratic running time.
- Easy to embed: a few C files need to be copied, the memory allocator can be redefined, the memory allocation failures are tested.
- MIT license.
Download
Source code:libbf-2025-06-03.tar.gz.
Related projects
LibBF has its roots inTinyPI.numcalc.com is a web version of the BFCalc calculator application.
Arbitrary precision floating point libraries:
Licensing
It is released under theMIT license.
Fabrice Bellard -https://bellard.org/
[8]ページ先頭