[ 
https://issues.apache.org/jira/browse/NUMBERS-14?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926538#comment-15926538
 ] 

Gilles commented on NUMBERS-14:
-------------------------------

In {{Precision}}?

This is the method in CM:
{code}
    public int hashCode() {
        if (isNaN) {
            return 7;
        }
        return 37 * (17 * MathUtils.hash(imaginary) +
            MathUtils.hash(real));
    }
{code}

For the moment, I'd just replace "MathUtils" with a private method designed as 
in 
[Double|https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#hashCode%28%29]:
{code}
private int hash(double d) {
  final long v = Double.doubleToLongBits(d);
  return (int)(v^(v>>>32));
}
{code}


> call to hashCode() in Complex
> -----------------------------
>
>                 Key: NUMBERS-14
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-14
>             Project: Commons Numbers
>          Issue Type: Improvement
>    Affects Versions: 1.0
>            Reporter: Eric Barnhill
>            Priority: Trivial
>              Labels: easyfix
>
> There is a call in Complex() to hashCode(). This calls a method 
> Precision.hash() . Looks like Precision.hash() is gone. I want to confirm 
> that this method is now gone from commons-numbers Precision() and 
> consequently I should remove this method.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to