Example usage for java.lang Double doubleToLongBits

List of usage examples for java.lang Double doubleToLongBits

Introduction

In this page you can find the example usage for java.lang Double doubleToLongBits.

Prototype

@HotSpotIntrinsicCandidate
public static long doubleToLongBits(double value) 

Source Link

Document

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Usage

From source file:com.opengamma.analytics.financial.interestrate.bond.definition.BillTransaction.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _billPurchased.hashCode();
    result = prime * result + _billStandard.hashCode();
    long temp;//from ww w.j av  a 2 s.c  o m
    temp = Double.doubleToLongBits(_quantity);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_settlementAmount);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.math.statistics.distribution.NormalDistribution.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from  www  .  j  ava2s  .c om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final NormalDistribution other = (NormalDistribution) obj;
    if (Double.doubleToLongBits(_mean) != Double.doubleToLongBits(other._mean)) {
        return false;
    }
    return Double.doubleToLongBits(_standardDeviation) == Double.doubleToLongBits(other._standardDeviation);
}

From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.Payment.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _currency.hashCode();
    result = prime * result + (_fundingCurveName == null ? 0 : _fundingCurveName.hashCode());
    long temp;/*w ww  . jav  a 2  s  .co  m*/
    temp = Double.doubleToLongBits(_paymentTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:Encdec.java

public static int enc_doublele(double d, byte[] dst, int di) {
    return enc_uint64le(Double.doubleToLongBits(d), dst, di);
}

From source file:com.relicum.ipsum.Location.BlockPoint.java

@Override
public int hashCode() {
    int result;/*from w  w  w .  j  a  va2  s  .  c  o m*/
    long temp;
    temp = Double.doubleToLongBits(X);
    result = (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(Y);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(Z);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    result = 31 * result + world.hashCode();
    return result;
}

From source file:com.opengamma.analytics.math.statistics.distribution.StudentTDistribution.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  w ww .java 2 s .  c  om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final StudentTDistribution other = (StudentTDistribution) obj;
    return Double.doubleToLongBits(_degFreedom) == Double.doubleToLongBits(other._degFreedom);
}

From source file:com.opengamma.maths.lowlevelapi.linearalgebra.blas.BLAS1.java

/**
 * DAXPY returns:=alpha*x+y//  w  ww .  jav a  2 s.c  o  m
 * @param alpha double
 * @param x a double[] vector
 * @param y a double[] vector
 * @return tmp double[] vector
 */
public static double[] daxpy(double alpha, double[] x, double[] y) {
    daxpyInputSanityChecker(x, y);
    final int n = y.length;
    double[] tmp = new double[n];
    if (Double.doubleToLongBits(alpha) == 0) { // short cut if alpha = 0, insanely stupid thing to do but might occur if coming from generated results
        System.arraycopy(y, 0, tmp, 0, n);
        return tmp;
    }
    final int extra = n - n % 16;
    final int ub = ((n / 16) * 16) - 1;
    // the induction (variable + loop unwind) common subexpression is actually spotted by the JIT and so
    // doesn't need to be spelled out which is a nice change
    for (int i = 0; i < ub; i += 16) {
        tmp[i] = alpha * x[i] + y[i];
        tmp[i + 1] = alpha * x[i + 1] + y[i + 1];
        tmp[i + 2] = alpha * x[i + 2] + y[i + 2];
        tmp[i + 3] = alpha * x[i + 3] + y[i + 3];
        tmp[i + 4] = alpha * x[i + 4] + y[i + 4];
        tmp[i + 5] = alpha * x[i + 5] + y[i + 5];
        tmp[i + 6] = alpha * x[i + 6] + y[i + 6];
        tmp[i + 7] = alpha * x[i + 7] + y[i + 7];
        tmp[i + 8] = alpha * x[i + 8] + y[i + 8];
        tmp[i + 9] = alpha * x[i + 9] + y[i + 9];
        tmp[i + 10] = alpha * x[i + 10] + y[i + 10];
        tmp[i + 11] = alpha * x[i + 11] + y[i + 11];
        tmp[i + 12] = alpha * x[i + 12] + y[i + 12];
        tmp[i + 13] = alpha * x[i + 13] + y[i + 13];
        tmp[i + 14] = alpha * x[i + 14] + y[i + 14];
        tmp[i + 15] = alpha * x[i + 15] + y[i + 15];
    }
    for (int i = extra; i < n; i++) {
        tmp[i] = alpha * x[i] + y[i];
    }
    return tmp;
}

From source file:com.opengamma.analytics.financial.model.interestrate.curve.PriceIndexCurveAddPriceIndexSpreadCurve.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from w  w  w  .  ja  va2s .co  m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final PriceIndexCurveAddPriceIndexSpreadCurve other = (PriceIndexCurveAddPriceIndexSpreadCurve) obj;
    if (!ObjectUtils.equals(_curves, other._curves)) {
        return false;
    }
    if (Double.doubleToLongBits(_sign) != Double.doubleToLongBits(other._sign)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurveAffineDividends.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + getDriftCurve().hashCode();
    result = prime * result + getForwardCurve().hashCode();
    long temp;/*from  www. j av a  2 s  .c om*/
    temp = Double.doubleToLongBits(getSpot());
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + getRiskFreeCurve().hashCode();
    result = prime * result + getDividends().hashCode();
    return result;
}

From source file:com.alibaba.citrus.util.internal.apache.lang.HashCodeBuilderTests.java

public void testDouble() {
    assertEquals(17 * 37, new HashCodeBuilder(17, 37).append(0d).toHashCode());
    double d = 1234567.89;
    long l = Double.doubleToLongBits(d);
    assertEquals(17 * 37 + (int) (l ^ l >> 32), new HashCodeBuilder(17, 37).append(d).toHashCode());
}