Evaluating the floating point in Java Virtual Machine
Download
Report
Transcript Evaluating the floating point in Java Virtual Machine
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:
Size
(bits)
64
Exp(bits) Mant.
( bits)
10
53
Sign
1
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.
Examples...
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 nonnegative 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.
Questions...