Package java.math

Examples of java.math.BigDecimal.longValue()


        if (!NumberType.isInLongLimits(result)) {
            throw Error.error(ErrorCode.X_22015);
        }

        if (isYearMonth) {
            return new IntervalMonthData(result.longValue(), this);
        }

        int nanos = (int) NumberType.scaledDecimal(result,
            DTIType.maxFractionPrecision);
View Full Code Here


        }

        int nanos = (int) NumberType.scaledDecimal(result,
            DTIType.maxFractionPrecision);

        return new IntervalSecondData(result.longValue(), nanos, this, true);
    }

    String intervalMonthToString(Object a) {

        StringBuffer sb     = new StringBuffer(8);
View Full Code Here

            if (bd.compareTo(MAX_LONG) > 0 || bd.compareTo(MIN_LONG) < 0) {
                throw Error.error(ErrorCode.X_22003);
            }

            return ValuePool.getLong(bd.longValue());
        } else if (a instanceof Double || a instanceof Float) {
            double d = ((Number) a).doubleValue();

            if (Double.isInfinite(d) || Double.isNaN(d)
                    || d >= (double) Long.MAX_VALUE + 1
View Full Code Here

            {
                return Integer.valueOf(value.intValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_LONG))
            {
                return Long.valueOf(value.longValue());
            }
            else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_BOOLEAN))
            {
                return Boolean.valueOf(value.intValue() == 1 ? true : false);
            }
View Full Code Here

            {
                return value;
            }
            else
            {
                return Long.valueOf(value.longValue());
            }
        }
        catch (SQLException e)
        {
            throw new NucleusDataStoreException(LOCALISER_RDBMS.msg("055002","Numeric", "" + param, column, e.getMessage()),e);
View Full Code Here

            if (bd.compareTo(BIG_DECIMAL_LONG_MAX) > 0 || bd.compareTo(BIG_DECIMAL_LONG_MIN) < 0) {
                throw new TemplateModelException(
                        "Number doesn't fit into a 64 bit signed integer (long): "
                        + bd);
            } else {
                return bd.longValue();
            }
        } else if (num instanceof BigInteger) {
            BigInteger bi = (BigInteger) num;
            if (bi.compareTo(BIG_INTEGER_LONG_MAX) > 0 || bi.compareTo(BIG_INTEGER_LONG_MIN) < 0) {
                throw new TemplateModelException(
View Full Code Here

        // update current progressive in WAR02..
        if (progressive!=null) {
          // record found: it will be incremented by 10...
          pstmt2 = conn.prepareStatement(
              "update SYS20_COMPANY_PROGRESSIVES set VALUE=VALUE+"+(incrementValue.longValue()*rows)+",LAST_UPDATE_USER=?,LAST_UPDATE_DATE=?  where "+
              "COMPANY_CODE_SYS01=? and TABLE_NAME='WAR02_WAREHOUSE_MOVEMENTS' and COLUMN_NAME='PROGRESSIVE' and VALUE="+progressive
          );
          pstmt2.setString(1,username);
          pstmt2.setTimestamp(2,new java.sql.Timestamp(System.currentTimeMillis()));
          pstmt2.setString(3,companyCodeSys01);
View Full Code Here

          pstmt2.setString(13,rset.getString(11));
          pstmt2.setString(14,rset.getString(12));

          deltaQty = rset.getBigDecimal(13);
          pstmt2.setBigDecimal(15,deltaQty);
          pstmt2.setString(16,deltaQty.longValue()<0?negWarehouseMotiveWar04:posWarehouseMotiveWar04);
          pstmt2.setBigDecimal(17,rset.getBigDecimal(14)); // progressiveHIE01
          pstmt2.setTimestamp(18,new java.sql.Timestamp(System.currentTimeMillis()));
          pstmt2.setString(19,username);
          pstmt2.setString(20,note);
          pstmt2.setString(21,username);
View Full Code Here

     * @see NumericValue#hashCode
     */

    public int hashCode() {
        BigDecimal round = value.setScale(0, BigDecimal.ROUND_DOWN);
        long value = round.longValue();
        if (value > Integer.MIN_VALUE && value < Integer.MAX_VALUE) {
            return (int)value;
        } else {
            return new Double(getDoubleValue()).hashCode();
        }
View Full Code Here

        BigDecimal bd = BigDecimal.valueOf(value, scale);
        MutableDecimal md = new MutableDecimal(value, scale);
        assertEquals(bd.toPlainString(), md.toString());
        String message = "value=" + value + ", scale=" + scale;
        if (bd.abs().compareTo(BD_2_63) < 0)
            assertEquals(message, bd.longValue(), md.longValue());
        assertEquals(message, bd.doubleValue(), md.doubleValue(), Math.abs(bd.doubleValue() / 1e15));

        MutableDecimal md1 = new MutableDecimal(value - 1, scale);
        BigDecimal bd1 = BigDecimal.valueOf(value - 1, scale);
        assertEquals(message, bd.compareTo(bd1), md.compareTo(md1));
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.