Name: rmT116609 Date: 09/01/2004
A DESCRIPTION OF THE REQUEST :
Currently Java provides no support for controlling the rounding direction of floating point operations, as per the IEEE 754 standard. For those using Java as a simulation modelling platform (and there is a growing community particularly in agent-based modelling -- see http://repast.sourceforge.net/, http://cs.gmu.edu/~eclab/projects/mason/, http://wiki.swarm.org/), this is a potential issue, as it prevents remedial action being taken in the event that a simulation model has floating point errors.
JUSTIFICATION :
1. Providing rounding direction setting facilities enables programmers to take some remedial action when detecting floating point errors. For example, they could use it as the basis for implementing machine interval arithmetic.
2. Java is a very useful programming environment for scientific simulation modelling, through its platform independence. This enables scientists to share models and repeat each other's results without having to worry about portability issues. As a scientific programming environment, full support for the IEEE 754 standard should be a requirement. Please also see:http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf. Part of this means providing support for the IEEE 754 directed roundings.
3. It is extremely unlikely that Java will be run on a chip that does not support IEEE 754, as this standard has been around for nearly 20 years. However, a method could be provided in the Double class returning a boolean indicating whether rounding direction support is available on this platform, or the accessor methods could throw an exception.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There are numerous ways this could be implemented. Joe Darcy's Borneo extensions are one idea (http://www.jddarcy.org/Borneo). A simple approach to implement directed rounding only might be to include class methods in the Float and Double classes to set and get the current rounding direction. Alternatively, methods could be added to the Math class to achieve this.
(Incident Review ID: 301601)
======================================================================
- relates to
-
JDK-5095286 Support IEEE 754 sticky bit exception flags
- Closed
-
JDK-5095601 Provide a machine interval arithmetic datatype
- Closed