Accuracy of Mathematical Functions in Julia
Mantas Mikaitis, Mosè Giordano, Tejaswa Rizyal
Key points
From the paper's conclusion- We have utilized the test bench to determine the errors of a subset of mathematical functions in Julia 1.12.7, for binary16, binary32, and binary64 IEEE 754 floating-point formats, and found maximum errors of \(0.4998\) to \(0.5002\) ULPs in binary16, and \(0.49\) to \(2.41\) ULPs in binary32 and \(0.49\) to \(2.46\) ULPs in binary64.
Abstract
Basic computer arithmetic operations are correctly rounded, whilst mathematical functions such as \(e^{x}\) , \(\ln(x)\) , or \(\sin(x)\) in general are not, meaning that implementations may provide different results when presented with the same input, differing in accuracy. We present a methodology and a software tool suited for exhaustive and non-exhaustive testing of mathematical functions in the Julia programming language. The software (a test bench) is designed to be easy to set up for running the accuracy tests in automatic regression testing. Users only need to supply a list of formats, choose the rounding modes, and specify the input space search strategies based on how long they can afford the testing to run. We have utilized the test bench to determine the errors of a subset of mathematical functions in Julia 1.12.7, for binary16, binary32, and binary64 IEEE 754 floating-point formats, and found maximum errors of \(0.4998\) to \(0.5002\) ULPs in binary16, and \(0.49\) to \(2.41\) ULPs in binary32 and \(0.49\) to \(2.46\) ULPs in binary64. The functions that are correctly rounded (error below \(0.5\) ULP) in binary16 and binary32 are sqrt and cbrt, and only sqrt in binary64. The following functions are correctly rounded only for binary16: asin, atanh, cospi, log2, sinh, sinpi, tanh.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Ziv: A Language for Correctly Rounded Math LibrariesarXiv · 2026
- When Double Rounding is CorrectarXiv · 2026
- Computing $ab+cd$ and other expressions with correct rounding in binary floating-point arithmeticarXiv · 2026
- Global approximations to the error function of real argument for vectorized computation.The Journal of chemical physics · 2026
- A framework for trackable and modular rounding error analysisarXiv · 2026
- Portable Extended-Precision Floating-Point Arithmetic for Scientific Computing KernelsarXiv · 2026