Java Numerics

Samuel A. Figueroa figueroaaslinky.cs.nyu.edu
Thu Feb 13 19:31:15 PST 1997


Bill Joy writes:
  >ALTERNATIVE PROPOSAL:
  >I have an alternative proposal, which doesn't involve language changes:
  >provide operations mul, add, etc. defined as
  >	double mul(double a, double b) throws FloatingPointOverflow,
  >FloatingPointUnderflow;
  >	double add(double a, double b) throws FloatingPointOverflow,
  >FloatingPointUnderflow;
  >Add such methods to a library in a standard place, and let code which
  >wishes to have an exception on these operations use these routines.

I am not a Java programmer, but in Ada, one could define multiple versions of
such functions, with one version, for example, allowing you to specify the
rounding mode for that one particular operation (most likely this would
reduce performance significantly, but it might be exactly what somebody wants
to do), and another version letting you tell the function, "Don't tell me if
underflow occurred.  I don't care about that, but do tell me if overflow
occurs," or "If division by zero occurs, return the value x."  Again, these
versions would most likely reduce performance.

Keith Bierman writes:
  >Other "java-like" languages may develop, and they may target other
  >markets. There should be efforts to allow for interoperability
  >perhaps.

Perhaps we should redirect our efforts, then, to Limbo (a language from Bell
Labs - see http://inferno.bell-labs.com/inferno), which I understand is already
interoperable with Java, and allows more freedom for implementors in the area
of floating-point arithmetic, though it is still IEEE-arithmetic based.

Sam Figueroa



More information about the Numeric-interest mailing list