java.lang.Math.getExponent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(255)

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

Math.getExponent介绍

[英]Returns the unbiased base-2 exponent of double d.
[中]返回双d的无偏基2指数。

代码示例

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

static boolean isNormal(double d) {
 return getExponent(d) >= MIN_EXPONENT;
}

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

static boolean isFinite(double d) {
 return getExponent(d) <= MAX_EXPONENT;
}

代码示例来源:origin: prestodb/presto

static boolean isFinite(double d) {
 return getExponent(d) <= MAX_EXPONENT;
}

代码示例来源:origin: prestodb/presto

static boolean isNormal(double d) {
 return getExponent(d) >= MIN_EXPONENT;
}

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

static boolean isFinite(double d) {
 return getExponent(d) <= MAX_EXPONENT;
}

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

static boolean isNormal(double d) {
 return getExponent(d) >= MIN_EXPONENT;
}

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

/**
 * Returns the exponent of float {@code f}.
 * @since 1.6
 */
public static int getExponent(float f) {
  return Math.getExponent(f);
}

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

/**
 * Returns the exponent of double {@code d}.
 * @since 1.6
 */
public static int getExponent(double d){
  return Math.getExponent(d);
}

代码示例来源: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: apache/incubator-druid

@Override
 protected ExprEval eval(double param)
 {
  return ExprEval.of(Math.getExponent(param));
 }
}

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

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

/**
 * Returns {@code true} if {@code x} represents a mathematical integer.
 *
 * <p>This is equivalent to, but not necessarily implemented as, the expression {@code
 * !Double.isNaN(x) && !Double.isInfinite(x) && x == Math.rint(x)}.
 */
@GwtIncompatible // java.lang.Math.getExponent, com.google.common.math.DoubleUtils
public static boolean isMathematicalInteger(double x) {
 return isFinite(x)
   && (x == 0.0
     || SIGNIFICAND_BITS - Long.numberOfTrailingZeros(getSignificand(x)) <= getExponent(x));
}

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

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: prestodb/presto

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

/**
 * Returns the {@code BigInteger} value that is equal to {@code x} rounded with the specified
 * rounding mode, if possible.
 *
 * @throws ArithmeticException if
 *     <ul>
 *       <li>{@code x} is infinite or NaN
 *       <li>{@code x} is not a mathematical integer and {@code mode} is {@link
 *           RoundingMode#UNNECESSARY}
 *     </ul>
 */
// #roundIntermediate, java.lang.Math.getExponent, com.google.common.math.DoubleUtils
@GwtIncompatible
public static BigInteger roundToBigInteger(double x, RoundingMode mode) {
 x = roundIntermediate(x, mode);
 if (MIN_LONG_AS_DOUBLE - x < 1.0 & x < MAX_LONG_AS_DOUBLE_PLUS_ONE) {
  return BigInteger.valueOf((long) x);
 }
 int exponent = getExponent(x);
 long significand = getSignificand(x);
 BigInteger result = BigInteger.valueOf(significand).shiftLeft(exponent - SIGNIFICAND_BITS);
 return (x < 0) ? result.negate() : result;
}

代码示例来源:origin: prestodb/presto

/**
 * Returns {@code true} if {@code x} represents a mathematical integer.
 *
 * <p>This is equivalent to, but not necessarily implemented as, the expression {@code
 * !Double.isNaN(x) && !Double.isInfinite(x) && x == Math.rint(x)}.
 */
@GwtIncompatible // java.lang.Math.getExponent, com.facebook.presto.jdbc.internal.guava.math.DoubleUtils
public static boolean isMathematicalInteger(double x) {
 return isFinite(x)
   && (x == 0.0
     || SIGNIFICAND_BITS - Long.numberOfTrailingZeros(getSignificand(x)) <= getExponent(x));
}

代码示例来源:origin: prestodb/presto

/**
 * Returns the {@code BigInteger} value that is equal to {@code x} rounded with the specified
 * rounding mode, if possible.
 *
 * @throws ArithmeticException if
 *     <ul>
 *       <li>{@code x} is infinite or NaN
 *       <li>{@code x} is not a mathematical integer and {@code mode} is {@link
 *           RoundingMode#UNNECESSARY}
 *     </ul>
 */
// #roundIntermediate, java.lang.Math.getExponent, com.facebook.presto.jdbc.internal.guava.math.DoubleUtils
@GwtIncompatible
public static BigInteger roundToBigInteger(double x, RoundingMode mode) {
 x = roundIntermediate(x, mode);
 if (MIN_LONG_AS_DOUBLE - x < 1.0 & x < MAX_LONG_AS_DOUBLE_PLUS_ONE) {
  return BigInteger.valueOf((long) x);
 }
 int exponent = getExponent(x);
 long significand = getSignificand(x);
 BigInteger result = BigInteger.valueOf(significand).shiftLeft(exponent - SIGNIFICAND_BITS);
 return (x < 0) ? result.negate() : result;
}

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

/**
 * Returns {@code true} if {@code x} represents a mathematical integer.
 *
 * <p>This is equivalent to, but not necessarily implemented as, the expression {@code
 * !Double.isNaN(x) && !Double.isInfinite(x) && x == Math.rint(x)}.
 */
@GwtIncompatible // java.lang.Math.getExponent, com.google.common.math.DoubleUtils
public static boolean isMathematicalInteger(double x) {
 return isFinite(x)
   && (x == 0.0
     || SIGNIFICAND_BITS - Long.numberOfTrailingZeros(getSignificand(x)) <= getExponent(x));
}

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

/**
 * Returns {@code true} if {@code x} represents a mathematical integer.
 *
 * <p>This is equivalent to, but not necessarily implemented as, the expression {@code
 * !Double.isNaN(x) && !Double.isInfinite(x) && x == Math.rint(x)}.
 */
@GwtIncompatible // java.lang.Math.getExponent, com.google.common.math.DoubleUtils
public static boolean isMathematicalInteger(double x) {
 return isFinite(x)
   && (x == 0.0
     || SIGNIFICAND_BITS - Long.numberOfTrailingZeros(getSignificand(x)) <= getExponent(x));
}

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

public static int log2(double x, RoundingMode mode) {
 checkArgument(x > 0.0 && isFinite(x), "x must be positive and finite");
 int exponent = getExponent(x);
 if (!isNormal(x)) {
  return log2(x * IMPLICIT_BIT, mode) - SIGNIFICAND_BITS;

相关文章