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.model.volatility.smile.fitting.LeastSquareSmileFitter.java

protected void testData(final EuropeanVanillaOption[] options, final BlackFunctionData[] data,
        final double[] errors, final double[] initialFitParameters, final BitSet fixed, final int nParameters) {
    Validate.notEmpty(options, "options");
    final int n = options.length;
    Validate.notNull(data, "data");
    Validate.isTrue(data.length == n, "Black function data array must be the same length as option array");
    if (errors != null) {
        Validate.isTrue(errors.length == n, "Error array length must be the same as the option array length");
    }/*from   ww w . j  ava2 s .  co  m*/
    Validate.notNull(initialFitParameters, "initial values");
    Validate.isTrue(initialFitParameters.length == nParameters,
            "must have length of initial values array equal to number of parameters");
    Validate.notNull(fixed, "fixed");

    final double t = options[0].getTimeToExpiry();
    final double fwd = data[0].getForward();
    final double df = data[0].getDiscountFactor();

    for (int i = 1; i < n; i++) {
        Validate.isTrue(Double.doubleToLongBits(options[i].getTimeToExpiry()) == Double.doubleToLongBits(t),
                "options not all at same time horizon");
        Validate.isTrue(Double.doubleToLongBits(data[i].getForward()) == Double.doubleToLongBits(fwd),
                "options don't all have same forward");
        Validate.isTrue(Double.doubleToLongBits(data[i].getDiscountFactor()) == Double.doubleToLongBits(df),
                "options don't all have same discount factors");
    }
}

From source file:com.opengamma.analytics.financial.interestrate.swaption.derivative.SwaptionCashFixedIbor.java

/**
 * Constructor from the expiry date, the underlying swap and the long/short flqg.
 * @param expiryTime The expiry time./*from  w  w  w.  j av a2  s.c  o m*/
 * @param strike The strike
 * @param underlyingSwap The underlying swap.
 * @param settlementTime The time (in years) to cash settlement.
 * @param isCall Call.
 * @param isLong The long (true) / short (false) flag.
 */
private SwaptionCashFixedIbor(final double expiryTime, final double strike,
        final SwapFixedCoupon<? extends Payment> underlyingSwap, final double settlementTime,
        final boolean isCall, final boolean isLong) {
    super(strike, expiryTime, isCall);
    ArgumentChecker.notNull(underlyingSwap, "underlying swap");
    ArgumentChecker.isTrue(
            Double.doubleToLongBits(underlyingSwap.getFixedLeg().getNthPayment(0).getFixedRate()) == Double
                    .doubleToLongBits(strike),
            "Strike not in line with underlying");
    ArgumentChecker.isTrue(isCall == underlyingSwap.getFixedLeg().isPayer(),
            "Call flag not in line with underlying");
    _underlyingSwap = underlyingSwap;
    _settlementTime = settlementTime;
    _isLong = isLong;
}

From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.formula.EuropeanVanillaOption.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + (_isCall ? 1231 : 1237);
    long temp;// w  ww  . j a  v  a2 s .c  o m
    temp = Double.doubleToLongBits(_k);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_t);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w w  w. ja v  a2  s. c o  m
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final CouponFloating other = (CouponFloating) obj;
    if (Double.doubleToLongBits(_fixingTime) != Double.doubleToLongBits(other._fixingTime)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.math.interpolation.KrigingInterpolatorND.java

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

From source file:io.seldon.client.beans.ItemSimilarityNodeBean.java

@Override
public int hashCode() {
    int result;//  ww  w.  j  a v  a 2  s .  com
    long temp;
    result = item != null ? item.hashCode() : 0;
    temp = sim != +0.0d ? Double.doubleToLongBits(sim) : 0L;
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.model.option.definition.PoweredOptionDefinition.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;/* w w  w  .  ja  v a2s .c  o m*/
    temp = Double.doubleToLongBits(_power);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:org.springdata.ehcache.core.Book.java

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

From source file:com.opengamma.engine.view.NumberDeltaComparer.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _decimalPlaces;
    long temp;/*from w w  w  . j  ava  2s. co m*/
    temp = Double.doubleToLongBits(_multiplier);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;//from   w  w  w .ja  v  a 2s  . com
    temp = Double.doubleToLongBits(_notional);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_paymentYearFraction);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}