Examples of scaleByPowerOfTen()


Examples of java.math.BigDecimal.scaleByPowerOfTen()

    }

    int magnitude = 0;
    // now iterate to get the approximate magnitude
    while (tmpVal.compareTo(BigDecimal.ONE) > 0) {
      tmpVal = tmpVal.scaleByPowerOfTen (-1);
      magnitude++;
    }
   
    // return it in the appropriate way
    if (smallerThanOne) return - magnitude;
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

    // get the scale factor to turn big decimal into a decimal < 1
    int factor = dec.precision() - dec.scale();
    factor = sign == 1 ? factor : -factor;

        // convert the absolute big decimal to string
        dec.scaleByPowerOfTen(Math.abs(dec.scale()));
        String digits = dec.unscaledValue().toString();

        // finally write out the pieces (sign, scale, digits)
        buffer.write((byte) ( sign + 1), invert);
        buffer.write((byte) ((factor >> 24) ^ 0x80), invert);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

        // get the scale factor to turn big decimal into a decimal < 1
        int factor = dec.precision() - dec.scale();
        factor = sign == 1 ? factor : -factor;

        // convert the absolute big decimal to string
        dec.scaleByPowerOfTen(Math.abs(dec.scale()));
        String digits = dec.unscaledValue().toString();

        // finally write out the pieces (sign, scale, digits)
        writeByte(buffer, (byte) ( sign + 1), invert);
        writeByte(buffer, (byte) ((factor >> 24) ^ 0x80), invert);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

  protected void func(DecimalColumnVector outV, LongColumnVector inV, int i) {

    // The resulting decimal value is 10e-9 * the input long value (i.e. seconds).
    //
    HiveDecimal result = HiveDecimal.create(inV.vector[i]);
    result = result.scaleByPowerOfTen(-9);
    outV.set(i, result);
  }
}
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

        // get the scale factor to turn big decimal into a decimal < 1
        int factor = dec.precision() - dec.scale();
        factor = sign == 1 ? factor : -factor;

        // convert the absolute big decimal to string
        dec.scaleByPowerOfTen(Math.abs(dec.scale()));
        String digits = dec.unscaledValue().toString();

        // finally write out the pieces (sign, scale, digits)
        buffer.write((byte) ( sign + 1), invert);
        buffer.write((byte) ((factor >> 24) ^ 0x80), invert);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

    // get the scale factor to turn big decimal into a decimal < 1
    int factor = dec.precision() - dec.scale();
    factor = sign == 1 ? factor : -factor;

        // convert the absolute big decimal to string
        dec.scaleByPowerOfTen(Math.abs(dec.scale()));
        String digits = dec.unscaledValue().toString();

        // finally write out the pieces (sign, scale, digits)
        buffer.write((byte) ( sign + 1), invert);
        buffer.write((byte) ((factor >> 24) ^ 0x80), invert);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.HiveDecimal.scaleByPowerOfTen()

        // get the scale factor to turn big decimal into a decimal < 1
        int factor = dec.precision() - dec.scale();
        factor = sign == 1 ? factor : -factor;

        // convert the absolute big decimal to string
        dec.scaleByPowerOfTen(Math.abs(dec.scale()));
        String digits = dec.unscaledValue().toString();

        // finally write out the pieces (sign, scale, digits)
        buffer.write((byte) ( sign + 1), invert);
        buffer.write((byte) ((factor >> 24) ^ 0x80), invert);
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.