80 likes | 196 Views
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.
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.