Codota Logo
BigInteger.doubleValue
Code IndexAdd Codota to your IDE (free)

How to use
doubleValue
method
in
java.math.BigInteger

Best Java code snippets using java.math.BigInteger.doubleValue (Showing top 20 results out of 2,241)

  • Common ways to obtain BigInteger
private void myMethod () {
BigInteger b =
  • Codota IconString value;new BigInteger(value)
  • Codota Iconnew BigInteger(1, magnitude)
  • Codota Iconnew BigInteger(value)
  • Smart code suggestions by Codota
}
origin: prestodb/presto

@Override
public double doubleValue() { return _value.doubleValue(); }
origin: redisson/redisson

@Override
public double doubleValue() { return _value.doubleValue(); }
origin: robovm/robovm

/**
 * Returns this {@code BigInteger} as a float. If {@code this} is too big to
 * be represented as a float, then {@code Float.POSITIVE_INFINITY} or
 * {@code Float.NEGATIVE_INFINITY} is returned. Note that not all integers
 * in the range {@code [-Float.MAX_VALUE, Float.MAX_VALUE]} can be exactly
 * represented as a float.
 */
@Override
public float floatValue() {
  return (float) doubleValue();
}
origin: org.codehaus.jackson/jackson-mapper-asl

@Override
public double getDoubleValue() { return _value.doubleValue(); }
origin: prestodb/presto

@Override
public double getRingFraction(String start, String end)
{
  return getTokenCountInRange(start, end).doubleValue() / TOTAL_TOKEN_COUNT.doubleValue();
}
origin: prestodb/presto

@Override
public double getRingFraction(String start, String end)
{
  return getTokenCountInRange(start, end).doubleValue() / TOTAL_TOKEN_COUNT.doubleValue();
}
origin: apache/drill

@Override
public double doubleValue() { return _value.doubleValue(); }
origin: prestodb/presto

protected void convertNumberToDouble() throws IOException
{
  /* 05-Aug-2008, tatus: Important note: this MUST start with
   *   more accurate representations, since we don't know which
   *   value is the original one (others get generated when
   *   requested)
   */

  if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
    _numberDouble = _numberBigDecimal.doubleValue();
  } else if ((_numTypesValid & NR_BIGINT) != 0) {
    _numberDouble = _numberBigInt.doubleValue();
  } else if ((_numTypesValid & NR_LONG) != 0) {
    _numberDouble = (double) _numberLong;
  } else if ((_numTypesValid & NR_INT) != 0) {
    _numberDouble = (double) _numberInt;
  } else {
    _throwInternal();
  }
  _numTypesValid |= NR_DOUBLE;
}

origin: redisson/redisson

protected void convertNumberToDouble() throws IOException
{
  /* 05-Aug-2008, tatus: Important note: this MUST start with
   *   more accurate representations, since we don't know which
   *   value is the original one (others get generated when
   *   requested)
   */

  if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
    _numberDouble = _numberBigDecimal.doubleValue();
  } else if ((_numTypesValid & NR_BIGINT) != 0) {
    _numberDouble = _numberBigInt.doubleValue();
  } else if ((_numTypesValid & NR_LONG) != 0) {
    _numberDouble = (double) _numberLong;
  } else if ((_numTypesValid & NR_INT) != 0) {
    _numberDouble = (double) _numberInt;
  } else {
    _throwInternal();
  }
  _numTypesValid |= NR_DOUBLE;
}

origin: org.codehaus.groovy/groovy

/**
 * Power of a BigInteger to a BigInteger certain exponent. Called by the '**' operator.
 *
 * @param self     a BigInteger
 * @param exponent a BigInteger exponent
 * @return a BigInteger to the power of a the exponent
 * @since 2.3.8
 */
public static BigInteger power(BigInteger self, BigInteger exponent) {
  if ((exponent.signum() >= 0) && (exponent.compareTo(BI_INT_MAX) <= 0)) {
    return self.pow(exponent.intValue());
  } else {
    return BigDecimal.valueOf(Math.pow(self.doubleValue(), exponent.doubleValue())).toBigInteger();
  }
}
origin: stackoverflow.com

 private static final double LOG2 = Math.log(2.0);

/**
 * Computes the natural logarithm of a BigInteger. Works for really big
 * integers (practically unlimited)
 * 
 * @param val Argument, positive integer
 * @return Natural logarithm, as in <tt>Math.log()</tt>
 */
public static double logBigInteger(BigInteger val) {
  int blex = val.bitLength() - 1022; // any value in 60..1023 is ok
  if (blex > 0)
    val = val.shiftRight(blex);
  double res = Math.log(val.doubleValue());
  return blex > 0 ? res + blex * LOG2 : res;
}
origin: org.apache.commons/commons-math3

/**
 * <p>
 * Returns a <code>double</code> whose value is
 * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
 * </p>
 *
 * @param exponent
 *            exponent to which this <code>BigFraction</code> is to be raised.
 * @return <tt>this<sup>exponent</sup></tt>.
 */
public double pow(final double exponent) {
  return FastMath.pow(numerator.doubleValue(),   exponent) /
      FastMath.pow(denominator.doubleValue(), exponent);
}
origin: org.codehaus.jackson/jackson-core-asl

protected void convertNumberToDouble()
  throws IOException, JsonParseException
{
  /* 05-Aug-2008, tatus: Important note: this MUST start with
   *   more accurate representations, since we don't know which
   *   value is the original one (others get generated when
   *   requested)
   */

  if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
    _numberDouble = _numberBigDecimal.doubleValue();
  } else if ((_numTypesValid & NR_BIGINT) != 0) {
    _numberDouble = _numberBigInt.doubleValue();
  } else if ((_numTypesValid & NR_LONG) != 0) {
    _numberDouble = (double) _numberLong;
  } else if ((_numTypesValid & NR_INT) != 0) {
    _numberDouble = (double) _numberInt;
  } else {
    _throwInternal(); // should never get here
  }

  _numTypesValid |= NR_DOUBLE;
}

origin: hibernate/hibernate-orm

private double extractDoubleValue(Object value) {
  if ( value instanceof BigInteger ) {
    return ( ( BigInteger ) value ).doubleValue();
  }
  else if ( value instanceof BigDecimal ) {
    return ( ( BigDecimal ) value ).doubleValue();
  }
  else {
    return Double.valueOf( value.toString() ).doubleValue();
  }
}
origin: graphql-java/graphql-java

  @Override
  public Double parseLiteral(Object input) {
    if (input instanceof IntValue) {
      return ((IntValue) input).getValue().doubleValue();
    } else if (input instanceof FloatValue) {
      return ((FloatValue) input).getValue().doubleValue();
    } else {
      throw new CoercingParseLiteralException(
          "Expected AST type 'IntValue' or 'FloatValue' but was '" + typeName(input) + "'."
      );
    }
  }
});
origin: google/guava

@AndroidIncompatible // TODO(cpovirk): File bug for BigDecimal.doubleValue().
public void testBigToDouble() {
 for (BigInteger b : ALL_BIGINTEGER_CANDIDATES) {
  if (b.doubleValue() != DoubleUtils.bigToDouble(b)) {
   failFormat(
     "Converting %s to double: expected doubleValue %s but got bigToDouble %s",
     b, b.doubleValue(), DoubleUtils.bigToDouble(b));
  }
 }
}
origin: google/guava

public void testConstantsEverySixteenthFactorial() {
 for (int i = 0, n = 0; n <= DoubleMath.MAX_FACTORIAL; i++, n += 16) {
  assertEquals(
    BigIntegerMath.factorial(n).doubleValue(), DoubleMath.everySixteenthFactorial[i]);
 }
}
origin: google/guava

public void testDoubleValue() {
 for (long value : TEST_LONGS) {
  UnsignedLong unsignedValue = UnsignedLong.fromLongBits(value);
  assertEquals(unsignedValue.bigIntegerValue().doubleValue(), unsignedValue.doubleValue());
 }
}
origin: google/guava

public void testDoubleValue() {
 for (int value : TEST_INTS) {
  UnsignedInteger unsignedValue = UnsignedInteger.fromIntBits(value);
  assertEquals(unsignedValue.bigIntegerValue().doubleValue(), unsignedValue.doubleValue());
 }
}
origin: google/guava

@GwtIncompatible // Math.ulp
public void testFactorial() {
 for (int i = 0; i <= DoubleMath.MAX_FACTORIAL; i++) {
  double actual = BigIntegerMath.factorial(i).doubleValue();
  double result = DoubleMath.factorial(i);
  assertEquals(actual, result, Math.ulp(actual));
 }
}
java.mathBigIntegerdoubleValue

Javadoc

Returns this BigInteger as a double. If this is too big to be represented as a double, then Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY is returned. Note that not all integers in the range [-Double.MAX_VALUE, Double.MAX_VALUE] can be exactly represented as a double.

Popular methods of BigInteger

  • <init>
    This internal constructor differs from its public cousin with the arguments reversed in two ways: it
  • valueOf
    Returns a BigInteger with the given two's complement representation. Assumes that the input array wi
  • toString
  • compareTo
    Compares this BigInteger with value. Returns -1if this < value, 0 if this == value and 1if this > va
  • longValue
    Returns this BigInteger as a long value. If this is too big to be represented as a long, then this %
  • add
    Adds the contents of the int arrays x and y. This method allocates a new int array to hold the answe
  • intValue
    Converts this BigInteger to an int. This conversion is analogous to a narrowing primitive conversion
  • toByteArray
    Returns the two's complement representation of this BigInteger in a byte array.
  • equals
    Compares this BigInteger with the specified Object for equality.
  • multiply
    Returns a BigInteger whose value is this * value.
  • subtract
    Subtracts the contents of the second int arrays (little) from the first (big). The first int array (
  • bitLength
    Calculate bitlength of contents of the first len elements an int array, assuming there are no leadin
  • subtract,
  • bitLength,
  • divide,
  • negate,
  • signum,
  • mod,
  • pow,
  • hashCode,
  • shiftLeft

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now