You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Elliotte Harold <el...@metalab.unc.edu> on 2005/10/14 13:37:22 UTC
Unnecessary casts in Commons-Math
I loaded Commons-Math into Eclipse, which promptly complained about
numerous unnecessary casts. For example, this cast to double in
LaguerreSolver.solve:
Complex N = new Complex((double)n, 0.0);
Complex N1 = new Complex((double)(n-1), 0.0);
If I submitted a patch to remove these unnecessary casts, would it be
likely to be accepted or rejected? Personally I find extra code like
this to be very ugly, but I know some programmers and projects like
these casts. If the commons-math policy is to use these, I'll set my
Eclipse project preferences to ignore this. If not I can patch it. What
do people prefer?
--
Elliotte Rusty Harold elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: Unnecessary casts in Commons-Math
Posted by Phil Steitz <ph...@gmail.com>.
Sorry for the late response on this. I would be -0 to removing
"unnecessary" casts throughtout [math], as we had some issues early on
with type conversions and decided that it was best to err on the side
of making casts explicit in the code.
Phil
On 10/18/05, J.Pietschmann <j3...@yahoo.de> wrote:
> Elliotte Harold wrote:
> > I loaded Commons-Math into Eclipse, which promptly complained about
> > numerous unnecessary casts. For example, this cast to double in
> > LaguerreSolver.solve:
> >
> > Complex N = new Complex((double)n, 0.0);
> > Complex N1 = new Complex((double)(n-1), 0.0);
> >
> > If I submitted a patch to remove these unnecessary casts, would it be
> > likely to be accepted or rejected? Personally I find extra code like
> > this to be very ugly, but I know some programmers and projects like
> > these casts. If the commons-math policy is to use these, I'll set my
> > Eclipse project preferences to ignore this. If not I can patch it. What
> > do people prefer?
>
> Dunno. I'll look after this next weekend. There are a few other issues
> pending with the new solvers anyway.
>
> J.Pietschmann
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: Unnecessary casts in Commons-Math
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Elliotte Harold wrote:
> I loaded Commons-Math into Eclipse, which promptly complained about
> numerous unnecessary casts. For example, this cast to double in
> LaguerreSolver.solve:
>
> Complex N = new Complex((double)n, 0.0);
> Complex N1 = new Complex((double)(n-1), 0.0);
>
> If I submitted a patch to remove these unnecessary casts, would it be
> likely to be accepted or rejected? Personally I find extra code like
> this to be very ugly, but I know some programmers and projects like
> these casts. If the commons-math policy is to use these, I'll set my
> Eclipse project preferences to ignore this. If not I can patch it. What
> do people prefer?
Dunno. I'll look after this next weekend. There are a few other issues
pending with the new solvers anyway.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org