commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard (Created) (JIRA) <>
Subject [jira] [Created] (MATH-755) On the contract of FieldElement<T>.divide(T)
Date Sun, 26 Feb 2012 17:56:48 GMT
On the contract of FieldElement<T>.divide(T)

                 Key: MATH-755
             Project: Commons Math
          Issue Type: Improvement
    Affects Versions: 3.0, 3.1
            Reporter: Sébastien Brisard
            Assignee: Sébastien Brisard
            Priority: Minor
             Fix For: 3.1

As discussed on the mailing list:
The contract of {{FieldElement<T>.divide(T)}} states that an {{ArithmeticException}}
should be thrown if the parameter is zero. However, for this boundary case
* {{BigFraction}} throws {{ZeroException}}
* {{ArithmeticException}} throws {{ArithmeticException}}
* {{Complex}} uses NaNs instead of exceptions
* {{Dfp}}, {{DfpDec}} use flags instead of exceptions
* {{Fraction}} throws {{MathArithmeticException}}.

There is a need for some cleaning up, which will proceed in two steps
# in version 3.0 of the {{FieldElement}} interface the statement that an exception must be
thrown will be removed. The rationale for this is that sometimes, an exception is actually
not wanted. For example, I'm using a wrapper around primitive {{double}}, and I want all boundary
cases to be handled _exactly_ the same way as the primitive operation "/").
# in version 3.1 of Commons Math, the _same_ exception (if any) will be thrown by all implementations.
This will require to chose between {{ArithmeticException}}, {{MathArithmeticException}} and

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message