commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: Why not BigDecimal?
Date Fri, 12 Feb 2010 20:02:32 GMT
Something Something a écrit :
> Apache Commons-Math seems like an excellent library, but what I don't
> understand is why we are using 'double' everywhere instead of BigDecimal.

Commons-math is a low level library intended to be used by many
different types of applications. Using primitive double as the standard
type is a fair bet to integrate smoothly with a priori unknown
applications. Using BigDecimal would greatly restrict the audience.

Also note that BigDecimal lacks many functions (sin, cos, sqrt, cbrt,
exp, log ...).

I also doubt performances would be on par with primitive doubles with
repset to speed, but this is only a personal guess that would need to be

> I wrote a simple program to run a Multiple Regression Analysis followed by
> Rank, and compared my results to those from R stats package and because of
> lack of precision the 'ranks' are way off.  I mean I am assuming that if we
> had used BigDecimal the ranks would have matched to the ones from R.

There are many other things that could explain differences. Even with
BigDecimal, it is difficult to set the proper scale, so your assumtion
needs to be verified.


> Is there something I am missing?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message