80 likes | 210 Vues
This project analyzes floating point precision errors in Java, focusing on the implementation of rounding modes and interval types to manage errors in scientific computations. The Java language provides two primitive types for floating point numbers: float and double. While double supports up to 16 decimal digits, it only guarantees accuracy for 14 significant digits, leading to unacceptable errors in high-precision scientific applications. Our objective is to implement double rounding modes, develop an interval type in Java, and build the Java-XSC API for improved numerical accuracy.
E N D
Evaluating the floating point in Java Virtual Machine Bruno José Torres Fernandes Renato Viana Ferreira Marcília Andrade Campos {bjtf, rvf, mac}@cin.ufpe.br
Motivation • Analysis of floating precision error in the Java programming language. • Rounding modes implementation. • Interval type implementantion to control errors in scientific computation.
Representing floating points numbers • The Java programming language offers two primitive types, float and double, and the wrapper classes Float and Double from the java.lang package. • Double representation:
Double Precision • The double primitive type supports 16 decimal digits but it only offers correctness for the 14 most significant digits. • For scientific computation, which needs high precision, this error margin is not acceptable, for it can cause wrong results.
Alternatives • Floating point is by nature inexact, but the Java Virtual Machine offers the BigDecimal class from the package java.math that offers perfect precision storing the floating value as two integers, the unscaled value as an integer and a non-negative 32-bit integer scale, which represents the number of digits to the right of the decimal point.
Purpose of the project • Implement double rounding modes; • Implement Interval type in Java and operations over the type; • Build Java-XSC API.