Papers
Topics
Authors
Recent
Search
2000 character limit reached

Monte-Carlo Arithmetic (MCA) Overview

Updated 7 July 2026
  • Monte-Carlo Arithmetic (MCA) is a stochastic method that replaces fixed rounding with randomized perturbations to produce a distribution of floating-point outputs.
  • It quantifies numerical stability by estimating precision loss and exposing sensitivity in computations across fields like neuroimaging.
  • Implementations such as Verificarlo automate instrumentation, enabling reproducibility tests and data augmentation in complex numerical pipelines.

Searching arXiv for recent and foundational papers on Monte-Carlo Arithmetic (MCA), stochastic arithmetic, Verificarlo, and neuroimaging applications. Monte-Carlo Arithmetic (MCA) is a stochastic arithmetic methodology for analyzing floating-point sensitivity by replacing deterministic round-off behavior with randomized perturbations at a chosen virtual precision, so that repeated executions of the same program produce a distribution of outputs rather than a single trace. Within the broader family of stochastic arithmetic, MCA is used to estimate floating-point losses of accuracy, quantify numerical uncertainty, expose instability and precision-dependent failures, and, in some settings, exploit perturbation-induced variability for downstream learning tasks (Denis et al., 2015, Sohier et al., 2018, Salari et al., 2021, Kiar et al., 2021).

1. Definition and conceptual scope

MCA is presented as a method for estimating floating-point rounding error and numerical sensitivity by turning floating-point computations into randomized experiments. Instead of treating each floating-point operation as fixed under IEEE-754 rounding, MCA injects randomness so that the result becomes a random variable, and the numerical quality of a computation is inferred statistically from repeated runs (Denis et al., 2015).

In the stochastic arithmetic taxonomy used in the literature, MCA is one of the principal alternatives to CESTAC. CESTAC replaces deterministic rounding by randomized rounding to upper or lower neighbors, typically equiprobably, whereas MCA simulates a chosen virtual precision by adding random noise proportional to the exponent of the perturbed value. Both methodologies therefore produce random outputs and require a statistical inference framework for interpreting significance and stability (Sohier et al., 2018).

The literature emphasizes that MCA is not committed to a normality assumption and is not committed to a statistical inference model. That distinction is methodologically important: the perturbation model defines how numerical noise is injected, but the inferential validity of conclusions depends on how the resulting samples are analyzed. This separation underlies later work on confidence intervals, Bernoulli-style significance testing, and centered-normal approximations for stochastic arithmetic outputs (Sohier et al., 2018).

2. Perturbation model and operational variants

The standard MCA perturbation model is

inexact(x)=x+2extξ,\mathrm{inexact}(x)=x+2^{e_x-t}\xi,

where exe_x is the exponent or order of magnitude of the floating-point value xx, tt is the virtual precision, and ξ\xi is uniformly distributed on (12,12)\left(-\frac12,\frac12\right). In this construction, the perturbation magnitude scales with the ulp size at the target precision (Denis et al., 2015, Salari et al., 2021).

The literature distinguishes three MCA variants for an operation xyx \circ y. Random Rounding (RR) perturbs the output,

round(inexact(xy)).\mathrm{round}(\mathrm{inexact}(x \circ y)).

Precision Bounding (PB) perturbs the operands,

round(inexact(x)inexact(y)).\mathrm{round}(\mathrm{inexact}(x)\circ \mathrm{inexact}(y)).

Full MCA perturbs both operands and result,

round(inexact(inexact(x)inexact(y))).\mathrm{round}(\mathrm{inexact}(\mathrm{inexact}(x)\circ \mathrm{inexact}(y))).

These modes are used to separate round-off on outputs from loss of significance on inputs, or to combine both effects in a single stochastic model (Denis et al., 2015, Sohier et al., 2018).

A domain-specific adaptation appears in neuroimaging work that targets elementary mathematical libraries rather than generic kernels. There, the multi-operation formulation is written

exe_x0

but the implementation deliberately perturbs only the outputs of library functions. The stated reason is that many libm routines are piecewise, discontinuous, or rely on carefully tuned deterministic approximations, so injecting perturbations into their internals would create unrealistically large variation unrelated to the effect of operating system updates (Salari et al., 2021).

This design choice clarifies an important feature of MCA practice: the perturbation model is general, but the placement of perturbations is application dependent. A plausible implication is that faithful use of MCA depends less on formal uniformity than on matching the perturbation boundary to the mechanism of interest, whether that mechanism is general round-off accumulation, compiler transformation, or cross-platform drift in math libraries.

3. Implementations, instrumentation, and runtime integration

A foundational implementation is Verificarlo, an LLVM-based compiler tool that automatically instruments floating-point operations with MCA-enabled versions. The tool compiles code through LLVM, applies an instrumentation pass at the optimized LLVM intermediate representation level, and replaces floating-point operations with MCA versions from MCALIB. Because instrumentation occurs after front-end and middle-end optimizations, Verificarlo captures the numerical consequences of transformations such as -ffast-math, -freciprocal-math, common subexpression elimination, and algebraic simplifications (Denis et al., 2015).

This IR-level placement is contrasted with source-to-source approaches such as CIL + MCALIB. The stated limitations of source-level rewriting are language restriction, blindness to compiler optimizations, and a mismatch between the code analyzed and the code actually executed after optimization. Verificarlo is presented as avoiding those problems while supporting C, C++, and Fortran via dragonegg (Denis et al., 2015).

Under the hood, Verificarlo uses a modified version of MCALIB, replaces the standard libc pseudo-random generator with Mersenne Twister, and performs MCA computations with MPFR. The papers identify MPFR-based high-precision arithmetic as a major source of runtime cost, but also emphasize that Monte Carlo samples are embarrassingly parallel and therefore amenable to thread-level acceleration (Denis et al., 2015).

A distinct but related implementation is the “fuzzy libmath” framework for simulating operating-system-induced variability in neuroimaging pipelines. In that framework, GNU libm is instrumented using Verificarlo by compiling the library with Clang/LLVM, rewriting floating-point operations in the LLVM IR to calls into the Verificarlo API, and compiling the modified IR into a shared library. The resulting library is loaded transparently with LD_PRELOAD, and the wrapper functions invoke the original libm routines via dlsym; after computing the original result, they add a floating-point zero to trigger instrumentation and return the perturbed value (Salari et al., 2021).

The shared-library shim model is significant because it allows existing pipelines to inherit perturbations at the numerical boundary where cross-platform differences commonly appear, without source changes or recompilation. The same paper suggests extension beyond GNU libm to libraries such as OpenBLAS or NumPy, indicating that MCA can be deployed at multiple levels of the numerical software stack (Salari et al., 2021).

4. Statistical estimators, significance, and confidence

Because MCA produces a distribution of outputs rather than a single deterministic answer, interpretation depends on statistics computed across repeated runs. A widely used MCA accuracy estimator is Parker’s significant-digit metric,

exe_x1

with exe_x2 the cross-sample standard deviation and exe_x3 the cross-sample mean. In practice, the sample version

exe_x4

is used as a compact summary of numerical stability when the exact answer is unavailable (Sohier et al., 2018).

A more general statistical framework defines significance probabilistically. Let exe_x5 denote an error variable formed from the stochastic arithmetic output relative to a fixed or random reference. The exe_x6-th bit of exe_x7 is significant with probability exe_x8 if

exe_x9

This unifies relative and scaled-absolute interpretations of significance across MCA and CESTAC, rather than tying significance exclusively to a specific estimator or a specific noise model (Sohier et al., 2018).

The same framework introduces the number of digits contributing to the accuracy of the results. The distinction is that significant digits are digits that agree with the reference with high probability, whereas contributing digits are digits that still improve the result even if they are not yet strictly significant. The paper argues that this distinction matters operationally when printing results, checkpointing, or passing values to other software (Sohier et al., 2018).

Confidence-interval methodology is developed in two regimes. Under the centered normality hypothesis, confidence bounds are obtained from the chi-square interval for the sample variance and yield corrected lower bounds on the number of significant or contributing digits. In the general case, with no distributional assumption, significance and contribution are recast as Bernoulli events and analyzed using binomial confidence reasoning, including the no-failure bound and Brown-adjusted intervals (Sohier et al., 2018).

Several caveats follow directly from that analysis. The standard MCA estimator by itself is not a sound confidence bound and can be optimistic; small sample sizes induce large uncertainty in xx0; normality cannot be assumed a priori; and stochastic arithmetic results remain input dependent and contingent on test coverage. The literature therefore treats stochastic arithmetic as a scalable statistical diagnostic rather than a formal proof method (Sohier et al., 2018).

5. Simulation of operating-system variability in neuroimaging

A major application of MCA is the simulation of reproducibility drift caused by operating system updates in neuroimaging pipelines. The central hypothesis is that many differences observed across Linux distributions and glibc versions arise primarily from tiny floating-point changes in elementary libm functions such as log, exp, and sin, rather than from algorithmic changes in the pipelines themselves. MCA is therefore used to perturb those library calls and to compare the resulting variability with variability measured under actual operating system changes (Salari et al., 2021).

In the Human Connectome Project preprocessing study, MCA simulations were parameterized by sweeping the virtual precision xx1 from 53 bits down to 1 bit in steps of 2. A mixed-precision policy was used: for xx2, only double-precision values were perturbed and single-precision values were held at 24 bits; for xx3, both single- and double-precision values were perturbed to the same virtual precision. For each subject and precision value, three fuzzy-libmath samples were generated to match the number of samples collected under the operating-system experiments (Salari et al., 2021).

Agreement between MCA-perturbed outputs and operating-system-perturbed outputs was assessed both globally and locally. Globally, the root-mean-square error between per-voxel significance maps was used to select a “global nearest virtual precision,” and the optimum was xx4 bits. Kolmogorov–Smirnov testing showed that the distributions of significant bits were “nearly identical” with xx5 on average and for 15 out of 20 individual subjects after multiple-comparison correction. Locally, both perturbation regimes produced similar spatial patterns of precision loss, especially at the brain-skull interface and between brain lobes (Salari et al., 2021).

The quantitative results indicate that the average number of significant bits in the processed images was only 7.76 out of 24 available bits, corresponding to 2.32 significant base-10 digits. At the same time, between-subject structure was preserved: samples clustered primarily by subject, the average RMSE within a subject was about 13 times smaller than the average RMSE between subjects, and dendrograms preserved the same subject ordering under both perturbation regimes. The study nevertheless notes that operating-system-induced and MCA-induced variability were of similar magnitude to subject-level effects, which underscores the practical relevance of numerical uncertainty in downstream analysis (Salari et al., 2021).

The same experiments exposed a failure regime. The pipeline failed to complete for at least one subject below xx6 bits, identified as the tolerance of the pipeline. Across all subjects, 51% of executions crashed when xx7 was between 1 and 11 bits, with no clear monotonic relationship between failure rate and precision. The failure arose in the Readout Distortion Correction portion of the workflow and seemed to stem from FSL FAST tissue segmentation, although the exact source was not determined (Salari et al., 2021).

These findings motivate the interpretation of MCA as a controllable emulator of likely numerical drift in HPC and containerized environments. The paper explicitly argues that a static execution environment can mask, rather than solve, numerical fragility, and that MCA can therefore serve both as a reproducibility stress test and as a tool for quantifying pipeline uncertainty (Salari et al., 2021).

6. Data augmentation and downstream learning in connectomics

A second neuroimaging line of work uses MCA not only to measure instability but also to generate multiple plausible realizations of the same data sample for supervised learning. In that formulation, the variability produced by controlled floating-point perturbations in a structural connectome estimation pipeline is interpreted as a distribution of plausible subject-specific brain networks rather than as mere nuisance noise (Kiar et al., 2021).

The study perturbed a diffusion MRI pipeline from the Nathan Kline Institute Rockland Sample by sparsely introducing MCA at machine precision, with each inexact floating-point operation perturbed by a zero-centered random variable 1 bit beyond the precision of the system. The workflow comprised denoising and alignment, probabilistic tractography in Dipy, mapping streamlines to brain regions using the Desikan-Killiany-Tourville parcellation, and producing symmetric xx8 adjacency matrices. Because the graphs were undirected, each connectome yielded 3,403 unique weighted edges (Kiar et al., 2021).

The dataset consisted of 100 individuals, 1 session each, and 20 MCA simulations per individual, yielding 2,000 connectomes total. The perturbed outputs were aggregated through several resampling strategies: Reference, Truncate, Jackknife, Mean, Median, Consensus, Mega-analysis, and Meta-analysis. Classification used a 20% held-out test set, stratified grouped 5-fold cross-validation on the remaining 80%, one of four preprocessing strategies, one of two dimensionality reductions to 20 features or components, and one of five scikit-learn classifiers (Kiar et al., 2021).

Across classifier and preprocessing combinations, MCA-based resampling improved test F1 from 0.773 to 0.812 on average and improved the custom generalizability score from 0.960 to 0.965. In some configurations, especially with AdaBoost, the improvements were larger, reaching up to 0.170 F1 and up to 0.150 generalizability, with peak generalizability of 0.994. The strongest performers were Consensus, Mega-analysis, and Meta-analysis (Kiar et al., 2021).

The only resampling method that did not improve performance was Truncate, which significantly worsened validation performance. The paper treats that negative result as substantive: because truncation explicitly removes variability across simulations, its degradation suggests that the variability itself contains useful information. The same study reports that, except for Mega-analysis, there was no relationship between the number of simulations and either F1 or generalizability, implying that even a small number of perturbations may provide most of the benefit (Kiar et al., 2021).

This use of MCA broadens its role from numerical audit to data augmentation. The paper describes the approach as training-free, pipeline-agnostic, and data-agnostic, and interprets the performance gains through the bias-variance trade-off: replacing a single possibly biased pipeline output with a cloud of plausible outputs can reduce overfitting and improve consistency between validation and test performance (Kiar et al., 2021).

The term “Monte-Carlo Arithmetic” has a specific meaning in numerical analysis and should be distinguished from other Monte Carlo methods involving arithmetic objects. A 2026 paper on irreducibility testing and arithmetic imprimitivity over xx9 is explicitly described as a paper on Monte-Carlo algorithms in symbolic/computational algebra, not on MCA in the floating-point error-analysis sense. There, the Monte-Carlo aspect arises from randomized prime sampling and aggregation of modular factorization data, not from stochastic perturbation of floating-point operations (Rivin, 1 Feb 2026).

Within floating-point analysis itself, MCA also occupies a specific position relative to CESTAC and related stochastic arithmetic tools. CESTAC randomizes rounding direction and is historically associated with CADNA; MCA perturbs values at a virtual precision and has been implemented in tools such as Verificarlo and Verrou. The two approaches share the need for repeated execution and statistical interpretation, but they differ in perturbation semantics, runtime behavior, and sometimes in their handling of branching and compiler optimization effects (Sohier et al., 2018, Denis et al., 2015).

The literature identifies several practical limitations. Stochastic arithmetic is run-time and input dependent; conclusions are only as strong as test coverage. Confidence intervals address sampling error rather than model error, so a method can be statistically confident about an inadequate perturbation model. Normality-based formulas are efficient but unsafe when the sampled distribution is non-normal, in which case Bernoulli-style analysis is preferred. MCA is also computationally expensive because it usually requires many samples and, in Verificarlo, relies on MPFR high-precision arithmetic (Sohier et al., 2018, Denis et al., 2015).

A further limitation is diagnostic granularity. Verificarlo provides automatic instrumentation and captures the influence of compiler optimizations, but the 2015 paper notes that it does not directly pinpoint the exact unstable operation responsible for a numerical pathology. Conversely, application-specific wrappers such as fuzzy libmath can localize perturbations to a plausible numerical interface, but they deliberately simplify the mechanism by perturbing function outputs rather than internal kernels (Denis et al., 2015, Salari et al., 2021).

Taken together, these works define MCA as a mature stochastic methodology for floating-point uncertainty analysis whose scope now includes reproducibility studies, numerical validation, failure-mode discovery, and data augmentation. The common thread is not randomness for its own sake, but the use of controlled perturbations and repeated execution to characterize the stability envelope of a computation under plausible floating-point variation (Sohier et al., 2018, Salari et al., 2021, Kiar et al., 2021).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Monte-Carlo Arithmetic (MCA).