Le 29/10/2013 15:00, Gilles a écrit :
> Hello.

Hi Gilles,

> 
> While working on MATH-1047, I wondered about the usefulness of those
> two methods. Excluding the trivial case (base=|1|), the result will
> overflow as soon as the exponent is larger than 31, when base=|2|,
> and sooner the larger the base.
> Hence, the methods amount to syntactic sugar to spare a cast from
> a "long" to an "int" exponent.
> IMO, this is not worth the number of source code lines.
> Unless there is an objection, I propose to deprecate those methods
> in 3.3 and remove them in 4.0.

There were three main reasons for this method :

 - in many cases, very low (and fixed) exponents are often encountered
   (say exponents up to half a dozen or so),
 - computation with long in Java bytecode is not done the same way as
   int because it needs two successive variable slots and requires
   successive memory loading, and thus is slower (of course, this effect
   disappears when the JIT compiler converts everything to native code
   if the processor is 64 bits),
 - forcing the user to add a cast clutters the code.

As always, your mileage may vary.

best regards,
Luc

> 
> 
> Regards,
> Gilles
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 
> 
> 


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

Reply via email to