commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard (Updated) (JIRA) <j...@apache.org>
Subject [jira] [Updated] (MATH-755) On the contract of FieldElement<T>.divide(T)
Date Mon, 27 Feb 2012 06:36:49 GMT

     [ https://issues.apache.org/jira/browse/MATH-755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sébastien Brisard updated MATH-755:
-----------------------------------

    Description: 
As discussed on the mailing list:
{quote}
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}}
* {{BigReal}} throws {{ArithmeticException}}
* {{Complex}} uses NaNs instead of exceptions
* {{Dfp}}, {{DfpDec}} use flags instead of exceptions
* {{Fraction}} throws {{MathArithmeticException}}.
{quote}

There is a need for some cleaning up, which will proceed in two steps
# in 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 "/").
# the _same_ exception (if any) will be thrown by all implementations. This will require to
chose between {{ArithmeticException}}, {{MathArithmeticException}} and {{ZeroException}}.

  was:
As discussed on the mailing list:
{quote}
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}}
* {{BigReal}} throws {{ArithmeticException}}
* {{Complex}} uses NaNs instead of exceptions
* {{Dfp}}, {{DfpDec}} use flags instead of exceptions
* {{Fraction}} throws {{MathArithmeticException}}.
{quote}

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
{{ZeroException}}.

    
> On the contract of FieldElement<T>.divide(T)
> --------------------------------------------
>
>                 Key: MATH-755
>                 URL: https://issues.apache.org/jira/browse/MATH-755
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0, 3.1
>            Reporter: Sébastien Brisard
>            Assignee: Sébastien Brisard
>            Priority: Minor
>              Labels: exception, field
>             Fix For: 3.1
>
>
> As discussed on the mailing list:
> {quote}
> 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}}
> * {{BigReal}} throws {{ArithmeticException}}
> * {{Complex}} uses NaNs instead of exceptions
> * {{Dfp}}, {{DfpDec}} use flags instead of exceptions
> * {{Fraction}} throws {{MathArithmeticException}}.
> {quote}
> There is a need for some cleaning up, which will proceed in two steps
> # in 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 "/").
> # the _same_ exception (if any) will be thrown by all implementations. This will require
to chose between {{ArithmeticException}}, {{MathArithmeticException}} and {{ZeroException}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message