Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5095600
Votes 10
Synopsis Provide support for IEEE 754 directed roundings
Category java:classes_lang
Reported Against 1.4.2
Release Fixed
State 11-Closed, Will Not Fix, request for enhancement
Priority: 4-Low
Related Bugs 5095286 , 5095601
Submit Date 01-SEP-2004
Description




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) 
======================================================================
Work Around
N/A
Evaluation
The least impact way to support this functionality would be to have methods such as

double add(double a, double b, RoundingMode rm)

where rm was one of the RoundingMode enum values from java.math.RoundingMode.  This approach would not require any systemic changes along the lines of the changes required for sticky flag support, see 5095286.  Directed roundings are also a needed building block for interval arithmetic, 5095601.

  xxxxx@xxxxx   2004-09-01
While there are definately use cases and algorithms that depend on access to the directed rounding modes, adding reliable support would be a large undertaking for the expected benefit.

Regrettably closing as will not fix.
Posted Date : 2010-01-12 03:09:08.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang