Examples of scaleByPowerOfTen()


Examples of java.math.BigDecimal.scaleByPowerOfTen()

        }
        if(((high & 0x8000000000000000l) != 0))
        {
            bigDecimal = bigDecimal.negate();
        }
        bigDecimal = bigDecimal.scaleByPowerOfTen(exponent);
        return bigDecimal;
    }


    private static BigDecimal constructFrom64(final long val)
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

            // NaN or infinite
            return null;
        }

        BigDecimal bigDecimal = new BigDecimal(sign * significand);
        bigDecimal = bigDecimal.scaleByPowerOfTen(exponent);
        return bigDecimal;
    }

    private static BigDecimal constructFrom32(final int val)
    {
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

            // NaN or infinite
            return null;
        }

        BigDecimal bigDecimal = new BigDecimal(sign * significand);
        bigDecimal = bigDecimal.scaleByPowerOfTen(exponent);
        return bigDecimal;
    }

/*

 
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

      result = result.multiply(qc, MathContext.DECIMAL32);
      result = result.multiply(qe, MathContext.DECIMAL32);
      result = result.multiply(ql, MathContext.DECIMAL32);
      assert result.compareTo(BigDecimal.ZERO) >= 0 && result.compareTo(BigDecimal.ONE) <= 0;

      long round5 = result.scaleByPowerOfTen(5).longValue();
      result = BigDecimal.valueOf(round5, 5);
      assert result.compareTo(BigDecimal.ZERO) >= 0 && result.compareTo(BigDecimal.ONE) <= 0;

      return result;
   }
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

    public static Date parseServiceSpecificDate(String dateString) {
        if (dateString == null)
            return null;
        try {
            BigDecimal dateValue = new BigDecimal(dateString);
            return new Date(dateValue.scaleByPowerOfTen(
                    AWS_DATE_MILLI_SECOND_PRECISION).longValue());
        } catch (NumberFormatException nfe) {
            throw new AmazonClientException("Unable to parse date : "
                    + dateString, nfe);
        }
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

     */
    public static String formatServiceSpecificDate(Date date) {
        if (date == null)
            return null;
        BigDecimal dateValue = BigDecimal.valueOf(date.getTime());
        return dateValue.scaleByPowerOfTen(0 - AWS_DATE_MILLI_SECOND_PRECISION)
                .toPlainString();
    }

    public static Date cloneDate(Date date) {
        return date == null ? null : new Date(date.getTime());
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

    }
    if (value instanceof BigDecimal) {
      BigDecimal bigDecimal = ((BigDecimal) value).stripTrailingZeros();
      try {
        final int scale = bigDecimal.scale();
        final long exact = bigDecimal.scaleByPowerOfTen(scale).longValueExact();
        writer.append("new java.math.BigDecimal(").append(exact).append("L");
        if (scale != 0) {
          writer.append(", ").append(scale);
        }
        return writer.append(")");
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

    public static Date parseServiceSpecificDate(String dateString) {
        if (dateString == null)
            return null;
        try {
            BigDecimal dateValue = new BigDecimal(dateString);
            return new Date(dateValue.scaleByPowerOfTen(
                    AWS_DATE_MILLI_SECOND_PRECISION).longValue());
        } catch (NumberFormatException nfe) {
            throw new AmazonClientException("Unable to parse date : "
                    + dateString, nfe);
        }
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

     */
    public static String formatServiceSpecificDate(Date date) {
        if (date == null)
            return null;
        BigDecimal dateValue = BigDecimal.valueOf(date.getTime());
        return dateValue.scaleByPowerOfTen(0 - AWS_DATE_MILLI_SECOND_PRECISION)
                .toPlainString();
    }
}
View Full Code Here

Examples of java.math.BigDecimal.scaleByPowerOfTen()

      result = result.multiply(qc, MathContext.DECIMAL32);
      result = result.multiply(qe, MathContext.DECIMAL32);
      result = result.multiply(ql, MathContext.DECIMAL32);
      assert result.compareTo(BigDecimal.ZERO) >= 0 && result.compareTo(BigDecimal.ONE) <= 0;

      long round5 = result.scaleByPowerOfTen(5).longValue();
      result = BigDecimal.valueOf(round5, 5);
      assert result.compareTo(BigDecimal.ZERO) >= 0 && result.compareTo(BigDecimal.ONE) <= 0;

      return result;
   }
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.