You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@gmail.com> on 2005/08/08 16:22:17 UTC

[math] Rounding implementation in MathUtils

Can someone else pls have a look at 
http://issues.apache.org/bugzilla/show_bug.cgi?id=35904

This is holding up the 1.1 release.  I like the support for all of the
rounding modes that we get by using BigDecimal and - though I have not
verified this - I would expect the results to be exact over a wider
range of <value, scale> combinations than direct implementation would
give.  On the other hand, we have the string conversion and object
creation overhead.  I haven't done any microbenchmarks, but if someone
else has the time, it might be good to look at direct impl of, say,
ROUND_HALF_UP vs. the current impl.  Opinions please...

I am inclined to close this as FIXED (once more tests have been
added).  Note that this will commit us to supporting all of the
rounding modes, even if we decide to replace the implemenation later. 
 Some of these - e.g. ROUND_NOT_NECESSARY -  may have funny semantics
for some double / float values.   Additional unit tests to document /
demonstrate / validate exactly how all of these modes work will be
needed in any case.

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org