Massimiliano Fasi
CPFloat: A C library for simulating low-precision arithmetic
Fasi, Massimiliano; Mikaitis, Mantas
Authors
Mantas Mikaitis
Abstract
One can simulate low-precision floating-point arithmetic via software by executing each arithmetic operation in hardware and then rounding the result to the desired number of significant bits. For IEEE-compliant formats, rounding requires only standard mathematical library functions, but handling subnormals, underflow, and overflow demands special attention, and numerical errors can cause mathematically correct formulae to behave incorrectly in finite arithmetic. Moreover, the ensuing implementations are not necessarily efficient, as the library functions these techniques build upon are typically designed to handle a broad range of cases and may not be optimized for the specific needs of rounding algorithms. CPFloat is a C library for simulating low-precision arithmetics. It offers efficient routines for rounding, performing mathematical computations, and querying properties of the simulated low-precision format. The software exploits the bit-level floating-point representation of the format in which the numbers are stored and replaces costly library calls with low-level bit manipulations and integer arithmetic. In numerical experiments, the new techniques bring a considerable speedup (typically one order of magnitude or more) over existing alternatives in C, C++, and MATLAB. To our knowledge, CPFloat is currently the most efficient and complete library for experimenting with custom low-precision floating-point arithmetic.
Citation
Fasi, M., & Mikaitis, M. (2023). CPFloat: A C library for simulating low-precision arithmetic. ACM Transactions on Mathematical Software, 49(2), 1-32. https://doi.org/10.1145/3585515
Journal Article Type | Article |
---|---|
Acceptance Date | Feb 9, 2023 |
Online Publication Date | Feb 25, 2023 |
Publication Date | Jun 17, 2023 |
Deposit Date | Apr 7, 2023 |
Publicly Available Date | Oct 4, 2023 |
Journal | ACM Transactions on Mathematical Software |
Print ISSN | 0098-3500 |
Electronic ISSN | 1557-7295 |
Publisher | Association for Computing Machinery (ACM) |
Volume | 49 |
Issue | 2 |
Article Number | 18 |
Pages | 1-32 |
DOI | https://doi.org/10.1145/3585515 |
Public URL | https://durham-repository.worktribe.com/output/1177500 |
Files
Published Journal Article
(1 Mb)
PDF
Licence
http://creativecommons.org/licenses/by/4.0/
Publisher Licence URL
http://creativecommons.org/licenses/by/4.0/
Copyright Statement
This work is licensed under a Creative Commons Attribution International 4.0 License. © 2023 Copyright held by the owner/author(s).
You might also like
Computational graphs for matrix functions
(2023)
Journal Article
The Dynamical Functional Particle Method for Multi-Term Linear Matrix Equations
(2022)
Journal Article
Stochastic rounding: implementation, error analysis and applications
(2022)
Journal Article
Generating Extreme-Scale Matrices with Specified Singular Values or Condition Numbers
(2021)
Journal Article