Abstract
Modern computing has adopted the floating point type as a default way to describe computations with real numbers. Thanks to dedicated hardware support, such computations are efficient on modern architectures, even in double precision. However, rigorous reasoning about the resulting programs remains difficult. This is in part due to a large gap between the finite floating point representation and the infinite-precision real-number semantics that serves as the developers' mental model. Because programming languages do not provide support for estimating errors, some computations in practice are performed more and some less precisely than needed.
We present a library solution for rigorous arithmetic computation. Our numerical data type library tracks a (double) floating point value, but also a guaranteed upper bound on the error between this value and the ideal value that would be computed in the real-value semantics. Our implementation involves a set of linear approximations based on an extension of affine arithmetic. The derived approximations cover most of the standard mathematical operations, including trigonometric functions, and are more comprehensive than any publicly available ones. Moreover, while interval arithmetic rapidly yields overly pessimistic estimates, our approach remains precise for several computational tasks of interest. We evaluate the library on a number of examples from numerical analysis and physical simulations. We found it to be a useful tool for gaining confidence in the correctness of the computation.
- DocWeb - Java SE 6 - java.lang.Math. http://doc.java.sun.com/DocWeb/#r/Java SE 6/java.lang.Math/columnMain.Google Scholar
- J. Stolfi's general-purpose C libraries. http://www.ic.unicamp.br/~stolfi/EXPORT/software/c/ Index.html#libaa, 2005.Google Scholar
- aaflib - An Affine Arithmetic C+ Library. http://aaflib.sourceforge.net/, 2010.Google Scholar
- The Computer Language Benchmarks Game. http://shootout.alioth.debian.org/, Jan 2011.Google Scholar
- B. Akbarpour and L. C. Paulson. MetiTarski: An Automatic Theorem Prover for Real-Valued Special Functions. J. Autom. Reason., 44(3), 2010. Google Scholar
Digital Library
- A. Ayad and C. Marché. Multi-Prover Verification of Floating-Point Programs. In IJCAR, 2010. Google Scholar
Digital Library
- T. Ball, E. Bounimova, R. Kumar, and V. Levin. Slam2: Static driver verification with under 4% false alarms. In FMCAD, pages 35--42, 2010. Google Scholar
Digital Library
- S. Boldo, J.-C. Filliâtre, and G. Melquiond. Combining Coq and Gappa for Certifying Floating-Point Programs. In CICM, 2009. Google Scholar
Digital Library
- S. Boldo and T. M. T. Nguyen. Hardware-independent proofs of numerical programs. In Proceedings of the Second NASA Formal Methods Symposium, 2010.Google Scholar
- B. Botella, A. Gotlieb, and C. Michel. Symbolic execution of floating-point computations. Softw. Test. Verif. Reliab., 2006. Google Scholar
Digital Library
- A. Brillout, D. Kroening, and T. Wahl. Mixed Abstractions for Floating-Point Arithmetic. In FMCAD, 2009.Google Scholar
Cross Ref
- S. Chaudhuri, S. Gulwani, and R. Lublinerman. Continuity analysis of programs. In POPL, 2010. Google Scholar
Digital Library
- L. Chen, A. Miné, J. Wang, and P. Cousot. A Sound Floating-Point Polyhedra Abstract Domain. In APLAS, 2008. Google Scholar
Digital Library
- P. Cousot, R. Cousot, J. Feret, L. Mauborgne, A. Miné, D. Monniaux, and X. Rival. The ASTRÉE Analyser. In ESOP, 2005.Google Scholar
- Manuvir Das, Sorin Lerner, and Mark Seigle. ESP: Path-sensitive program verification in polynomial time. 2002.Google Scholar
- M. Davis. DoubleDouble.java. http://tsusiatsoftware.net/dd/main.html.Google Scholar
- L. H. de Figueiredo and J. Stolfi. Self-Validated Numerical Methods and Applications. IMPA/CNPq, Brazil, 1997.Google Scholar
- L. H. de~Figueiredo and J. Stolfi. Affine Arithmetic: Concepts and Applications. Numerical Algorithms, 2004.Google Scholar
- Isil Dillig, Thomas Dillig, and Alex Aiken. Sound, complete and scalable path-sensitive analysis. In PLDI, 2008. Google Scholar
Digital Library
- A. G. Ershov and T. P. Kashevarova. Interval Mathematical Library Based on Chebyshev and Taylor Series Expansion. Reliable Computing, 11, 2005.Google Scholar
- C.F. Fang, Tsuhan C., and R.A. Rutenbar. Floating-point error analysis based on affine arithmetic. In ICASSP, 2003.Google Scholar
Cross Ref
- A.A. Gaffar, O. Mencer, and W. Luk. Unifying bit-width optimisation for fixed-point and floating-point designs. In Field-Programmable Custom Computing Machines, 2004. FCCM 2004. 12th Annual IEEE Symposium on, pages 79 -- 88, april 2004. Google Scholar
Digital Library
- D. Goldberg. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv., 23(1), 1991. Google Scholar
Digital Library
- J. Gosling, B. Joy, G. Steele, and G. Bracha. Java(TM) Language Specification, The 3rd Edition. Addison-Wesley, 2005. Google Scholar
Digital Library
- E. Goubault and S. Putot. Static Analysis of Finite Precision Computations. In VMCAI, 2011. Google Scholar
Digital Library
- Ch. Grimm, W. Heupke, and K. Waldschmidt. Refinement of Mixed-Signal Systems with Affine Arithmetic. In DATE, 2004. Google Scholar
Digital Library
- J. Harrison. Formal Verification at Intel. In LICS, 2003. Google Scholar
Digital Library
- L. Hatton and A. Roberts. How Accurate is Scientific Software? IEEE Trans. Softw. Eng., 20, 1994. Google Scholar
Digital Library
- F. Ivancic, M. K. Ganai, S. Sankaranarayanan, and A. Gupta. Numerical stability analysis of floating-point computations using software model checking. In MEMOCODE, 2010.Google Scholar
Digital Library
- B. Jeannet and A. Miné. Apron: A Library of Numerical Abstract Domains for Static Analysis. In CAV, 2009. Google Scholar
Digital Library
- F. Jézéquel and J.-M. Chesneaux. CADNA: a library for estimating round-off error propagation. Computer Physics Communications, 178(12), 2008.Google Scholar
- J. Jiang, W. Luk, and D. Rueckert. FPGA-Based Computation of Free-Form Deformations. In Field - Programmable Logic and Applications. 2003.Google Scholar
- W. Kahan. Miscalculating Area and Angles of a Needle-like Triangle. Technical report, University of California Berkeley, 2000.Google Scholar
- A.B. Kinsman and N. Nicolici. Finite Precision bit-width allocation using SAT-Modulo Theory. In DATE, 2009. Google Scholar
Digital Library
- Etienne Kneuss, Philippe Suter, and Viktor Kuncak. Runtime instrumentation for precise flow-sensitive type analysis. In International Conference on Runtime Verification, 2010. Google Scholar
Digital Library
- Viktor Kuncak, Patrick Lam, Karen Zee, and Martin Rinard. Modular pluggable analyses for data structure consistency. IEEE Transactions on Software Engineering, 32(12), December 2006. Google Scholar
Digital Library
- D.-U. Lee, A. A. Gaffar, R. C. C. Cheung, O. Mencer, W. Luk, and G. A. Constantinides. Accuracy-Guaranteed Bit-Width Optimization. IEEE Trans. on CAD of Integrated Circuits and Systems, 25(10), 2006. Google Scholar
Digital Library
- X. Leroy. Verified squared: does critical software deserve verified tools? In POPL, 2011. Google Scholar
Digital Library
- M. D. Linderman, M. Ho, D. L. Dill, T. H. Meng, and G. P. Nolan. Towards program optimization through automated analysis of numerical precision. In CGO, 2010. Google Scholar
Digital Library
- T. Lindholm and F. Yellin. Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., 2nd edition, 1999. Google Scholar
Digital Library
- R. Longbottom. Whetstone Benchmark Java Version. http://www.roylongbottom.org.uk/online/whetjava.html, 1997.Google Scholar
- R. Majumdar and I. Saha. Symbolic Robustness Analysis. In IEEE Real-Time Systems Symposium, 2009. Google Scholar
Digital Library
- M. Martel. An overview of semantics for the validation of numerical programs. In VMCAI, 2005. Google Scholar
Digital Library
- R. Martin, H. Shou, I. Voiculescu, A. Bowyer, and G. Wang. Comparison of interval methods for plotting algebraic curves. Comput. Aided Geom. Des., 19(7), 2002. Google Scholar
Digital Library
- D. Monniaux. The pitfalls of verifying floating-point computations. ACM Trans. Program. Lang. Syst., 30(3), 2008. Google Scholar
Digital Library
- J. S. Moore, T. W. Lynch, and M. Kaufmann. A Mechanically Checked Proof of the AMD5 K86 Floating Point Division Program. IEEE Trans. Computers, 47(9), 1998. Google Scholar
Digital Library
- R.E. Moore. Interval Analysis. Prentice-Hall, 1966.Google Scholar
- M. Odersky, L. Spoon, and B. Venners. Programming in Scala: a comprehensive step-by-step guide. Artima Press, 2008. Google Scholar
Digital Library
- R. Pozo and B. R. Miller. Java SciMark 2.0. http://math.nist.gov/scimark2/about.html, 2004.Google Scholar
- D. M. Priest. Algorithms for Arbitrary Precision Floating Point Arithmetic. In Proceedings of the 10th Symposium on Computer Arithmetic, 1991.Google Scholar
Cross Ref
- Scala Programming~Language Blog. '==' and equals. http://scala-programming-language.1934581.n4.nabble.com/and-equals-td22%61488.html, June 2010.Google Scholar
- T. Rompf and M. Odersky. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs. In GPCE, 2010. Google Scholar
Digital Library
- P. M. Rondon, M. Kawaguci, and R. Jhala. Liquid types. In PLDI, pages 159--169, 2008. Google Scholar
Digital Library
- D. M. Russinoff. A Mechanically Checked Proof of Correctness of the AMD K5 Floating Point Square Root Microcode. Formal Methods in System Design, 1999. Google Scholar
Digital Library
- R. A. Rutenbar, C. F. Fang, M. Püschel, and T. Chen. Toward efficient static analysis of finite-precision effects in DSP applications via affine arithmetic modeling. In DAC, 2003. Google Scholar
Digital Library
- T. R. Scavo and J. B. Thoo. On the Geometry of Halley's Method. The American Mathematical Monthly, 102(5), 1995.Google Scholar
- H. Shou, R.R. Martin, I. Voiculescu, A. Bowyer, and G. Wang. Affine Arithmetic in Matrix Form for Polynomial Evaluation and Algebraic Curve Drawing. Progress in Natural Science, 12, 2002.Google Scholar
- IEEE~Computer Society. IEEE Standard for Floating-Point Arithmetic. IEEE Std 754--2008, 2008.Google Scholar
- J. Walker. fbench - Trigonometry Intense Floating Point Benchmark. http://www.fourmilab.ch/fbench/fbench.html, 2007.Google Scholar
- J. White. Fbench.java. http://code.google.com/p/geo-reminder/source/browse/trunk/benchmark-and%roid/src/com/benchmark/suite/Fbench.java?r=108, 2005.Google Scholar
- L. Zhang, Y. Zhang, and W. Zhou. Tradeoff between Approximation Accuracy and Complexity for Range Analysis using Affine Arithmetic. Journal of Signal Processing Systems, 61, 2010. Google Scholar
Digital Library
Index Terms
Trustworthy numerical computation in Scala
Recommendations
Trustworthy numerical computation in Scala
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsModern computing has adopted the floating point type as a default way to describe computations with real numbers. Thanks to dedicated hardware support, such computations are efficient on modern architectures, even in double precision. However, rigorous ...
Minimizing the complexity of SRT tables
This paper presents an analysis of the complexity of quotient-digit selection tables in SRT division implementations. SRT dividers are widely used in VLSI systems to compute floating-point quotients. These dividers use a fixed number of partial ...
Termination of Floating-Point Computations
Numerical computations form an essential part of almost any real-world program. Traditional approaches to termination of logic programs are restricted to domains isomorphic to ( ,>); more recent works study termination of integer computations where the ...







Comments