Package com.ibm.icu.math

Examples of com.ibm.icu.math.BigDecimal


   *
   * @stable ICU 3.2
   */
  public static BigDecimal toBigDecimal(long universalTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);
    BigDecimal universal = new BigDecimal(universalTime);
    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return universal.divide(units, BigDecimal.ROUND_HALF_UP).subtract(epochOffset);
  }
View Full Code Here


   *
   * @stable ICU 3.2
   */
  public static BigDecimal toBigDecimal(BigDecimal universalTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);
    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return universalTime.divide(units, BigDecimal.ROUND_HALF_UP).subtract(epochOffset);
  }
View Full Code Here

   * @deprecated This API is ICU internal only.
   */
  @Deprecated
  public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale) {
    TimeScaleData data = getTimeScaleData(timeScale);
    BigDecimal units = new BigDecimal(data.units);
    BigDecimal epochOffset = new BigDecimal(data.epochOffset);

    return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset);
  }
View Full Code Here

    private StringBuffer format(BigInteger number, StringBuffer result,
            FieldPosition fieldPosition, boolean parseAttr) {
        // If we are to do rounding, we need to move into the BigDecimal
        // domain in order to do divide/multiply correctly.
        if (roundingIncrementICU != null) {
            return format(new BigDecimal(number), result, fieldPosition);
        }

        if (multiplier != 1) {
            number = number.multiply(BigInteger.valueOf(multiplier));
        }
View Full Code Here

                        (Number) new Long(big.longValue()) : (Number) big;
                }
            }
            // Handle non-integral values or the case where parseBigDecimal is set
            else {
                BigDecimal big = digitList.getBigDecimalICU(status[STATUS_POSITIVE]);
                n = big;
                if (mult != 1) {
                    n = big.divide(BigDecimal.valueOf(mult),
                            BigDecimal.ROUND_HALF_EVEN);
                }
            }
        }
View Full Code Here

     * @stable ICU 2.0
     */
//#if defined(FOUNDATION10) || defined(ECLIPSE_FRAGMENT)
    public BigDecimal getRoundingIncrement() {
        if (roundingIncrementICU == null) return null;
        return new BigDecimal(roundingIncrementICU.toString());
    }
View Full Code Here

            roundingDouble = newValue;
            if (roundingDouble < 1.0d) {
                double rawRoundedReciprocal = 1.0d/roundingDouble;
                setRoundingDoubleReciprocal(rawRoundedReciprocal);
            }
            setInternalRoundingIncrement(new BigDecimal(newValue));
        }
    }
View Full Code Here

    private StringBuffer format(BigInteger number, StringBuffer result, FieldPosition fieldPosition,
                                boolean parseAttr) {
        // If we are to do rounding, we need to move into the BigDecimal
        // domain in order to do divide/multiply correctly.
        if (roundingIncrementICU != null) {
            return format(new BigDecimal(number), result, fieldPosition);
        }

        if (multiplier != 1) {
            number = number.multiply(BigInteger.valueOf(multiplier));
        }
View Full Code Here

                    n = (big.bitLength() < 64) ? (Number) new Long(big.longValue()) : (Number) big;
                }
            }
            // Handle non-integral values or the case where parseBigDecimal is set
            else {
                BigDecimal big = digitList.getBigDecimalICU(status[STATUS_POSITIVE]);
                n = big;
                if (mult != 1) {
                    n = big.divide(BigDecimal.valueOf(mult), mathContext);
                }
            }
        }

        // Assemble into CurrencyAmount if necessary
View Full Code Here

     */
    public void setRoundingIncrement(java.math.BigDecimal newValue) {
        if (newValue == null) {
            setRoundingIncrement((BigDecimal) null);
        } else {
            setRoundingIncrement(new BigDecimal(newValue));
        }
    }
View Full Code Here

TOP

Related Classes of com.ibm.icu.math.BigDecimal

Copyright © 2018 www.massapicom. 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.