/** Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift); long signifRounded = increment ? signifFloor + 1 : signifFloor; long bits = (long) (exponent + EXPONENT_BIAS) << SIGNIFICAND_BITS;
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift); long signifRounded = increment ? signifFloor + 1 : signifFloor; long bits = (long) ((exponent + EXPONENT_BIAS)) << SIGNIFICAND_BITS;
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift); long signifRounded = increment ? signifFloor + 1 : signifFloor; long bits = (long) ((exponent + EXPONENT_BIAS)) << SIGNIFICAND_BITS;
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift); long signifRounded = increment ? signifFloor + 1 : signifFloor; long bits = (long) ((exponent + EXPONENT_BIAS)) << SIGNIFICAND_BITS;
exponent -= 2; lowestSetBit = mantissa.getLowestSetBit(); discardedSize = mantissa.bitLength() - 54; if (discardedSize > 0) {// (n > 54)
q = q.divide(gcd); k = q.getLowestSetBit(); q = q.shiftRight(k);
ks[i] = rpTmp.getLowestSetBit(); rpTmp = rpTmp.clearBit(ks[i]);
/** * Returns this {@code BigDecimal} as a big integer instance if it has no * fractional part. If this {@code BigDecimal} has a fractional part, i.e. * if rounding would be necessary, an {@code ArithmeticException} is thrown. * * @return this {@code BigDecimal} as a big integer value. * @throws ArithmeticException * if rounding is necessary. */ public BigInteger toBigIntegerExact() { if ((scale == 0) || (isZero())) { return getUnscaledValue(); } else if (scale < 0) { return getUnscaledValue().multiply(Multiplication.powerOf10(-(long)scale)); } else {// (scale > 0) BigInteger[] integerAndFraction; // An optimization before do a heavy division if ((scale > approxPrecision()) || (scale > getUnscaledValue().getLowestSetBit())) { throw new ArithmeticException("Rounding necessary"); } integerAndFraction = getUnscaledValue().divideAndRemainder(Multiplication.powerOf10(scale)); if (integerAndFraction[1].signum() != 0) { // It exists a non-zero fractional part throw new ArithmeticException("Rounding necessary"); } return integerAndFraction[0]; } }
int twos = denominator.getLowestSetBit();
&& (bitLength <= MAX_FLOAT_OR_INT_LOG_2 || bitLength == MAX_FLOAT_OR_INT_LOG_2 + 1 && biNum.getLowestSetBit() >= MAX_FLOAT_OR_INT_LOG_2)) { return new BigIntegerOrFloat(biNum); } else if ((typeFlags & TypeFlags.DOUBLE) != 0 && (bitLength <= MAX_DOUBLE_OR_LONG_LOG_2 || bitLength == MAX_DOUBLE_OR_LONG_LOG_2 + 1 && biNum.getLowestSetBit() >= MAX_DOUBLE_OR_LONG_LOG_2)) { return new BigIntegerOrDouble(biNum); } else {
/** * Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** * Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
/** * Returns {@code true} if {@code x} represents a power of two. */ public static boolean isPowerOfTwo(BigInteger x) { checkNotNull(x); return x.signum() > 0 && x.getLowestSetBit() == x.bitLength() - 1; }
@Override protected boolean isPowerOfTwo(Object value) { BigInteger bintValue = (BigInteger) value; int bitIndex = bintValue.getLowestSetBit(); if (bitIndex < 0) { return false; } return bintValue.clearBit(bitIndex).equals(BigInteger.ZERO); } };
@Override public NodeValue exec(NodeValue x) { if ( ! x.isInteger() ) throw new ExprEvalException("evenInteger: Not an intger: "+x) ; int i = x.getInteger().getLowestSetBit() ; boolean b = (i == -1) || ( i != 0 ) ; return NodeValue.makeNodeBoolean( b ) ; }