Examples of signum()


Examples of java.math.BigInteger.signum()

    public BigInteger floor() {
      BigInteger temp = sqrt(b.multiply(b).multiply(d));
      if (b.signum() == -1)
        temp = temp.add(BigInteger.ONE).negate();
      temp = temp.add(a);
      if (temp.signum() == -1)
        temp = temp.subtract(c.subtract(BigInteger.ONE));
      return temp.divide(c);
    }
   
   
View Full Code Here

Examples of java.math.BigInteger.signum()

    public BigInteger floor() {
      BigInteger temp = sqrt(b.multiply(b).multiply(d));
      if (b.signum() == -1)
        temp = temp.add(BigInteger.ONE).negate();
      temp = temp.add(a);
      if (temp.signum() == -1)
        temp = temp.subtract(c.subtract(BigInteger.ONE));
      return temp.divide(c);
    }
   
   
View Full Code Here

Examples of java.math.BigInteger.signum()

        void set(BigDecimal newValue) {
            this.scale = newValue.scale();

            BigInteger unscaled = newValue.unscaledValue();
            if (unscaled.signum() >= 0) {
                this.plus = true;
            } else {
                this.plus = false;
                unscaled = unscaled.negate();
            }
View Full Code Here

Examples of java.math.BigInteger.signum()

        while (--src_pos >= 0 && nBytes-- > 0) {
          data[pos] = bytes[src_pos];
          pos += delta;
        }
        if (nBytes > 0) {
          byte sign_byte = (byte)(big_int.signum() < 0 ? -1 : 0);
          while (nBytes-- > 0) {
            data[pos] = sign_byte;
            pos += delta;
          }
        }
View Full Code Here

Examples of java.math.BigInteger.signum()

    }

    public static UnsignedLong valueOf(final String value)
    {
        BigInteger bigInt = new BigInteger(value);
        if(bigInt.signum() == -1 || bigInt.bitCount()>64)
        {
            throw new NumberFormatException("Value \""+value+"\" lies outside the range [" + 0L + "- 2^64).");
        }
        else if(bigInt.compareTo(LONG_MAX_VALUE)>=0)
        {
View Full Code Here

Examples of java.math.BigInteger.signum()

                    && r.getUpper().compareTo(messageNumber) >= 0) {
                    done = true;
                    break;
                } else {
                    BigInteger diff = r.getLower().subtract(messageNumber);
                    if (diff.signum() == 1) {
                        if (diff.equals(BigInteger.ONE)) {
                            r.setLower(messageNumber);
                            done = true;
                        }
                        break;
View Full Code Here

Examples of java.math.BigInteger.signum()

        while (true) {
           
            // can process now if no other in process and this one is next
            if (inProcessNumber == null) {
                BigInteger diff = mn.subtract(highNumberCompleted);
                if (BigInteger.ONE.equals(diff) || (canSkip && diff.signum() > 0)) {
                    inProcessNumber = mn;
                    return true;
                }
            }
           
View Full Code Here

Examples of java.math.BigInteger.signum()

    }

    public BigIntegerToken getRandomToken()
    {
        BigInteger token = FBUtilities.hashToBigInteger(GuidGenerator.guidAsBytes());
        if ( token.signum() == -1 )
            token = token.multiply(BigInteger.valueOf(-1L));
        return new BigIntegerToken(token);
    }

    private final Token.TokenFactory<BigInteger> tokenFactory = new Token.TokenFactory<BigInteger>() {
View Full Code Here

Examples of java.math.BigInteger.signum()

                result.set(Calendar.ERA, year < 0 ? GregorianCalendar.BC : GregorianCalendar.AD);
                result.set(Calendar.YEAR, Math.abs(year));
            }
            else {
                BigInteger eonAndYear = getEonAndYear();
                result.set(Calendar.ERA, eonAndYear.signum() == -1 ? GregorianCalendar.BC : GregorianCalendar.AD);
                result.set(Calendar.YEAR, eonAndYear.abs().intValue());
            }
        }

        // only set month if it is set
View Full Code Here

Examples of java.math.BigInteger.signum()

                result.set(Calendar.ERA, year < 0 ? GregorianCalendar.BC : GregorianCalendar.AD);
                result.set(Calendar.YEAR, Math.abs(year));
            }
            else {
                final BigInteger eonAndYear = getEonAndYear();
                result.set(Calendar.ERA, eonAndYear.signum() == -1 ? GregorianCalendar.BC : GregorianCalendar.AD);
                result.set(Calendar.YEAR, eonAndYear.abs().intValue());
            }
        }
        else {
            // use default if set
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.