On 04/17/2012 07:50 AM, Roger Riggs wrote:
I'm not sure have all the history around the Math vs StrictMath
distinction.
For the more "interesting" mathematical methods where multiple
implementations are reasonable, the StrictMath version provides
cross-platform reproducibility by specifying the particular algorithm
that is used while the Math class only specifies general quality of
implementation criteria.
There are many cross references between Math and StrictMath for common
functions, for example, ulp, getExponent, copySign, etc.
The distinction is clearer for floating point operations than for
int/log computations.
For operations where the Math and StrictMath siblings are specified to
have the same output for all arguments, it is valid for either one to
delegate to the other. It is always valid for Math.foo to be
implemented as a call to StrictMath.foo, but the reverse is not always true.
Since the Math methods are probably called more often, *if the Math and
StrictMath methods are semantically equivalent*, I'd recommend putting
the real implementation in Math and having StrictMath do the call to its
sibling.
Cheers,
-Joe
Roger
On 04/16/2012 05:27 PM, Alex Lam S.L. wrote:
Hi there,
Sorry if this has been asked before, but I am curious as to why the
newer methods in StrictMath (including addExact etc.) are now
delegating to methods in Math.
Looking at the other static methods, they seem to be going in the
opposite direction, i.e. Math methods calling equivalent methods in
StrictMath.
Thanks,
Alex.
On Mon, Apr 16, 2012 at 10:08 PM, Roger
Riggs<roger.ri...@oracle.com> wrote:
Hi,
I've corrected a number of issues raised with javadoc in java.lang.Math
and java.lang.StrictMath. The updated webrev is:
http://cr.openjdk.java.net/~rriggs/6282196.2/
Please review.
Thanks, Roger
On 03/05/2012 08:38 AM, Roger Riggs wrote:
CR 6282196 There should be Math.mod(number, modulo) methods
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6282196
Requests that floor and modulus methods be provided for primitive
types.
Floor division is pretty straight-forward, rounding toward minus
infinity.
For modulus of int and long, the sign and range follow the exiting
floor
method
in java.util.Math and satisfy the relation that mod(x, y) = (x -
floorDiv(x, y) * y).