[ 
https://issues.apache.org/jira/browse/MATH-433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929402#action_12929402
 ] 

Phil Steitz commented on MATH-433:
----------------------------------

I don't agree necessarily that we are inconsistent.  I don't understand exactly 
where the inconsistency is, unless you are talking about the Integer-valued 
methods throwing ArithmeticException instead of wrapping.   There are two 
classes of Integer-valued methods that do this in MathUtils.  The first are the 
methods that are designed all and only to do this - addAndCheck et al.  The 
second are the factorial, binomial coefficient and lcm computing methods.  
These methods are documented to throw ArithmeticException on integer overflow.  
I do not see this as inconsistent.  I am not aware of any methods in [math] 
that return integer values, can overflow and are not checked in this way.  Do 
you have examples?

> Signal overflow by raising an exception
> ---------------------------------------
>
>                 Key: MATH-433
>                 URL: https://issues.apache.org/jira/browse/MATH-433
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Priority: Minor
>
> Referring to the ML thread (with subject "Factorial").
> Shouldn't Commons-Math always raise an exception when overflow is detected, 
> including in cases where the Java language specification has decided to 
> return infinity?
> It was argued, in the ML thread on "FunctionEvaluationException", that it was 
> much better to raise an exception than to rely on special values to detect 
> problems. I think that the same argument fits perfectly in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to