java.lang.Double.doubleToRawLongBits()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(204)

本文整理了Java中java.lang.Double.doubleToRawLongBits()方法的一些代码示例,展示了Double.doubleToRawLongBits()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Double.doubleToRawLongBits()方法的具体详情如下:
包路径:java.lang.Double
类名称:Double
方法名:doubleToRawLongBits

Double.doubleToRawLongBits介绍

[英]Returns an integer corresponding to the bits of the given IEEE 754 double precision value. Not-a-Number (NaN) values are preserved (compare to #doubleToLongBits).
[中]返回与给定IEEE 754双精度值的位对应的整数*保留非数字(NaN)*值(与#doubleToLongBits比较)。

代码示例

代码示例来源:origin: google/guava

/**
 * Creates a new {@code AtomicDouble} with the given initial value.
 *
 * @param initialValue the initial value
 */
public AtomicDouble(double initialValue) {
 value = doubleToRawLongBits(initialValue);
}

代码示例来源:origin: google/guava

/**
 * Sets to the given value.
 *
 * @param newValue the new value
 */
public final void set(double newValue) {
 long next = doubleToRawLongBits(newValue);
 value = next;
}

代码示例来源:origin: google/guava

static double scaleNormalize(double x) {
 long significand = doubleToRawLongBits(x) & SIGNIFICAND_MASK;
 return longBitsToDouble(significand | ONE_BITS);
}

代码示例来源:origin: google/guava

/**
 * Atomically sets the value to the given updated value if the current value is <a
 * href="#bitEquals">bitwise equal</a> to the expected value.
 *
 * @param expect the expected value
 * @param update the new value
 * @return {@code true} if successful. False return indicates that the actual value was not
 *     bitwise equal to the expected value.
 */
public final boolean compareAndSet(double expect, double update) {
 return updater.compareAndSet(this, doubleToRawLongBits(expect), doubleToRawLongBits(update));
}

代码示例来源:origin: google/guava

/**
 * Atomically sets the element at position {@code i} to the given updated value if the current
 * value is <a href="#bitEquals">bitwise equal</a> to the expected value.
 *
 * @param i the index
 * @param expect the expected value
 * @param update the new value
 * @return true if successful. False return indicates that the actual value was not equal to the
 *     expected value.
 */
public final boolean compareAndSet(int i, double expect, double update) {
 return longs.compareAndSet(i, doubleToRawLongBits(expect), doubleToRawLongBits(update));
}

代码示例来源:origin: google/guava

/**
 * Sets the element at position {@code i} to the given value.
 *
 * @param i the index
 * @param newValue the new value
 */
public final void set(int i, double newValue) {
 long next = doubleToRawLongBits(newValue);
 longs.set(i, next);
}

代码示例来源:origin: google/guava

/**
 * Eventually sets the element at position {@code i} to the given value.
 *
 * @param i the index
 * @param newValue the new value
 */
public final void lazySet(int i, double newValue) {
 long next = doubleToRawLongBits(newValue);
 longs.lazySet(i, next);
}

代码示例来源:origin: google/guava

/**
 * Eventually sets to the given value.
 *
 * @param newValue the new value
 */
public final void lazySet(double newValue) {
 long next = doubleToRawLongBits(newValue);
 updater.lazySet(this, next);
}

代码示例来源:origin: google/guava

/**
 * Atomically sets to the given value and returns the old value.
 *
 * @param newValue the new value
 * @return the previous value
 */
public final double getAndSet(double newValue) {
 long next = doubleToRawLongBits(newValue);
 return longBitsToDouble(updater.getAndSet(this, next));
}

代码示例来源:origin: google/guava

/**
 * Atomically sets the element at position {@code i} to the given value and returns the old value.
 *
 * @param i the index
 * @param newValue the new value
 * @return the previous value
 */
public final double getAndSet(int i, double newValue) {
 long next = doubleToRawLongBits(newValue);
 return longBitsToDouble(longs.getAndSet(i, next));
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Adds a CONSTANT_Double_info to the constant pool of this symbol table. Does nothing if the
 * constant pool already contains a similar item.
 *
 * @param value a double.
 * @return a new or already existing Symbol with the given value.
 */
Symbol addConstantDouble(final double value) {
 return addConstantLongOrDouble(Symbol.CONSTANT_DOUBLE_TAG, Double.doubleToRawLongBits(value));
}

代码示例来源:origin: google/guava

/** The notion of equality used by AtomicDoubleArray */
static boolean bitEquals(double x, double y) {
 return Double.doubleToRawLongBits(x) == Double.doubleToRawLongBits(y);
}

代码示例来源:origin: google/guava

@Override
public final Hasher putDouble(double d) {
 return putLong(Double.doubleToRawLongBits(d));
}

代码示例来源:origin: google/guava

/** The notion of equality used by AtomicDouble */
static boolean bitEquals(double x, double y) {
 return Double.doubleToRawLongBits(x) == Double.doubleToRawLongBits(y);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuf writeDouble(double value) {
  writeLong(Double.doubleToRawLongBits(value));
  return this;
}

代码示例来源:origin: google/guava

static long getSignificand(double d) {
 checkArgument(isFinite(d), "not a normal value");
 int exponent = getExponent(d);
 long bits = doubleToRawLongBits(d);
 bits &= SIGNIFICAND_MASK;
 return (exponent == MIN_EXPONENT - 1) ? bits << 1 : bits | IMPLICIT_BIT;
}

代码示例来源:origin: google/guava

static void assertBitEquals(double x, double y) {
 assertEquals(Double.doubleToRawLongBits(x), Double.doubleToRawLongBits(y));
}

代码示例来源:origin: google/guava

static void assertBitEquals(double x, double y) {
 assertEquals(Double.doubleToRawLongBits(x), Double.doubleToRawLongBits(y));
}

代码示例来源:origin: google/guava

public void testOneBits() {
 assertEquals(DoubleUtils.ONE_BITS, Double.doubleToRawLongBits(1.0));
}

代码示例来源:origin: google/guava

/** Reconstitutes the instance from a stream (that is, deserializes it). */
 private void readObject(java.io.ObjectInputStream s)
   throws java.io.IOException, ClassNotFoundException {
  s.defaultReadObject();

  int length = s.readInt();
  ImmutableLongArray.Builder builder = ImmutableLongArray.builder();
  for (int i = 0; i < length; i++) {
   builder.add(doubleToRawLongBits(s.readDouble()));
  }
  this.longs = new AtomicLongArray(builder.build().toArray());
 }
}

相关文章