A Large-Scale Study of Floating-Point Usage in Statically Typed Languages

Andrea Gilot, Tobias Wrigstad, Eva Darulova · 2025

Read A Large-Scale Study of Floating-Point Usage in Statically Typed Languages by Andrea Gilot, Tobias Wrigstad, Eva Darulova (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-04936.txt.

Introduction

Floating-point arithmetic is famously tricky to reason about, yet little is known about how real code uses it. Andrea Gilot, lead author with two co-authors, close that gap with a large-scale GitHub study in a 2025 paper. They focus on statically typed languages so the study can scale to millions of repositories.

Sampling and filtering follow careful mining practices to avoid bias. The team identify floating-point use from keywords and parse code for constructs such as loops. Their results confirm floating-point code is widespread. They also find literature benchmarks match real-world code in some respects but not others, and they publish a large dataset of extracted functions.

Catalog record

CREATORAndrea Gilot, Tobias Wrigstad, Eva Darulova
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE59 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-04936

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

A Large-Scale Study of Floating-Point Usage in Statically Typed Languages Andrea Gilot, Tobias Wrigstad, Eva Darulova Abstract . Reasoning about floating-point arithmetic is notoriously hard. While static and dynamic analysis techniques or program repair have made significant progress, more work is still needed to make them relevant to real-world code. On the critical path to that goal is understanding what real-world floating-point code looks like. To close that knowledge gap, this paper presents the first large-scale empirical study of floating-point arithmetic usage in statically typed languages across public GitHub repositories. We follow state-of the art mining practices including random sampling and filtering based on only intrinsic properties to avoid bias, and identify floating-point usage by searching for keywords in the source code, and programming language constructs ( e.g., loops) by parsing the code. Our evaluation supports the claim often made in papers that floating-point arithmetic is widely used. Comparing statistics such as size and usage of certain constructs and functions, we find that benchmarks used in literature to evaluate automated reasoning techniques for floating-point arithmetic are in certain aspects representative of ‘real-world’ code, but not in all. We aim for our study and dataset to help future techniques for floating-point arithmetic to be designed and evaluated to match actual users’ expectations. 1. Introduction Numerical software is widely used across different domains such as embedded systems, scientific computing, and machine learning. Numerical software frequently makes use of floating-point arithmetic to efficiently approximate computations with real numbers. Some approximation of the infinitely precise reals is necessary, which introduces rounding errors at most arithmetic operations as well as potentially the special values infinity and Not-a-Number (NaN). Overall this make reasoning about the correctness of such software unintuitive, error prone and time consuming. — This could be the beginning of a paper on automated reasoning for floating-point programs, e.g., with a static ( Darulova et al. 2018 ; Solovyev et al. 2018 ) or a dynamic approach ( Zou et al. 2019 ; Guo and Rubio-González 2020 ; Zou et al. 2022a ) . Such an approach would typically be evaluated either using a small benchmark suite ( Damouche et al. 2017 ) , or on a relatively small set of benchmarks hand-picked specifically for that paper. While hand-picking benchmarks can be helpful to demonstrate particular features and issues, it is unclear how they generalize to “real-world” code. To the best of our knowledge, no large-scale code study has investigated how representative the currently used benchmarks are of “real-world” usage, e.g., in terms of size, operations performed, or frequency of library function usage. Neither do we know how widely used floating-point arithmetic really is. While real-world floating-point usage is largely anecdotal, the difficulty in developing automated reasoning techniques for floating-point arithmetic is well documented. For example, static analysis techniques bounding worst-case rounding errors ( Titolo et al. 2025 ; Darulova et al. 2018 ; Solovyev et al. 2018 ) are limited to small programs (mostly individual functions) and have no or limited support for common program constructs such as conditionals and loops. This is also reflected in the standard benchmark set used in this domain ( Damouche et al. 2017 ) . Dynamic approaches aiming to identify specific inputs that induce large rounding errors ( Guo and Rubio-González 2020 ; Zou et al. 2019 ) , or for repairing such errors ( Zou et al. 2022b ) are evaluated on different, hand-picked sets of benchmarks, most of which are typically small ( e.g., individual functions). In summary, the current benchmarks used align with the current capabilities of the tools, but it is unclear to what extent they align with actual users’ expectations. This paper presents the first large-scale study of statically typed real-world floating-point code. The aim is to inform current and future research efforts in this domain, for example by aiding (more) representative selections of benchmarks for evaluation, and to guide the development of future benchmarks and reasoning techniques in a practically relevant direction. Characterising “real-world floating-point code” is non-trivial for several reasons. First, limiting ourselves to publicly available code, real-world code bases use a multitude of programming languages and the volume is too large to be processed and inspected in full. The latter can be addressed by sampling, but to avoid measurement bias, the code must be checked for code clones ( Lopes et al. 2017 ) , and filtered to exclude projects that do not contain any code at all and “toy” projects ( e.g., from class assignments, or projects that were never updated after the initial commit). While a convenient and continuously updated dataset of GitHub projects aimed for code studies ( Dabic et al. 2021 ) exists, it includes only projects with at least ten stars (to reduce the amount of data). Such filtering has been shown to skew the results significantly ( Maj et al. 2024 ) , making it unsuitable to generalise from. Second, once we have a set of “interesting” projects, there is no existing tool that can efficiently identify and analyze floating-point code. Such analysis must be automated to be able to handle sufficiently large volumes of code. Furthermore, it should be able to handle different programming languages. This paper makes the following contributions: Large-Scale Floating-Point Mining We design and implement a large-scale mining methodology ( Section 3 ) for detecting and analyzing floating-point usage in statically typed languages at the project, file and function level. Our approach combines intrinsic property filtering, keyword-based detection, fuzzy duplicate elimination and parsing to produce a reliable dataset. Large parts of the methodology and implementation are not specific to floating-point analysis and we expect them to be reused in other large-scale empirical code studies. Quantitative Analysis We analyse 453\,891 GitHub projects ( Section 4 ) and present the results in Section 5 . Our analysis shows that, with 95 % confidence, over 62 % of the projects contain floating-point code, supporting the claim that floating-points are widely used. We are the first to draw this conclusion based on a large-scale code study of open-source code. Most functions in our final dataset tend to be small, and function calls and conditional statements appear more often than loops and (explicitly mentioned) special values. The FPBench ( Damouche et al. 2017 ) benchmarks used in literature to evaluate floating-point techniques show different characteristics, e.g., involving fewer conditionals and more transcendental library function calls. Functions from the GNU Scientific Library, often used in evaluations, appear rarely in our dataset. Floating-Point Functions Dataset We release a dataset of 10 million real-world floating-point functions extracted from our study 1 1 1 Available at https://doi.org/10.5281/zenodo.17055623 . This dataset sets a new bar in terms of representativeness and scale, and can serve as a foundation for constructing new benchmarks and evaluating floating-point analysis tools. 2. Related Work Floating-Point Reasoning Benchmarks Most works that focus on numerical programs are evaluated using different sets of hand-picked programs. Hand-picking programs can be good for stressing certain types of problems, but can just as easily—intentionally or not—suppress other problems and challenges. It is also unclear how to generalise from hand-picked problems to code “in the real world”. One benchmark set specifically for floating-point analysis exists (FPBench ( Damouche et al. 2017

Read the complete text