Package java.math

Examples of java.math.BigDecimal.longValue()


        assertEquals(PropertyType.DECIMAL, value.getType());
        assertEquals(value, factory.createValue(a));

        try { value.getBoolean(); fail(); } catch (ValueFormatException e) {}
        assertEquals(a.longValue(), value.getDate().getTimeInMillis());
        assertEquals(a, value.getDecimal());
        assertEquals(a.doubleValue(), value.getDouble());
        assertEquals(a.longValue(), value.getLong());
        assertEquals(a.toString(), value.getString());
View Full Code Here


        try { value.getBoolean(); fail(); } catch (ValueFormatException e) {}
        assertEquals(a.longValue(), value.getDate().getTimeInMillis());
        assertEquals(a, value.getDecimal());
        assertEquals(a.doubleValue(), value.getDouble());
        assertEquals(a.longValue(), value.getLong());
        assertEquals(a.toString(), value.getString());

        // TODO: binary representation
    }
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 (session instanceof Session) {
                if (!((Session) session).database.sqlConvertTruncate) {
View Full Code Here

            throw Error.error(ErrorCode.X_22015);
        }

        if (isNumberDiv) {
            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);
        } else {
            if (isYearMonth) {
                return result.longValue();
            } else {
View Full Code Here

            return new IntervalSecondData(result.longValue(), nanos, this,
                                          true);
        } else {
            if (isYearMonth) {
                return result.longValue();
            } else {
                return result;
            }
        }
    }
View Full Code Here

    // this matches DB2 UDB behaviour

    if (   (localValue.compareTo(SQLDecimal.MINLONG_MINUS_ONE) == 1)
      && (localValue.compareTo(SQLDecimal.MAXLONG_PLUS_ONE) == -1)) {

      return localValue.longValue();
    }

    throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "BIGINT");
  }
View Full Code Here

       ** This loses the fractional part, but it probably doesn't
       ** matter for numbers that are big enough to overflow a double -
       ** it's probably rare for numbers this big to be different only in
       ** their fractional parts.
       */
      longVal = localValue.longValue();
    }
    else
    {
      longVal = (long) doubleVal;
      if (longVal != doubleVal)
View Full Code Here

                    inputType+"]Expected count to be 4", "4", f2.toString());

            } else {
                Long f2 = (Long)((Tuple)output).get(1);
                assertEquals("[Testing " + avgTypes[k] + " on input type: "+
                    inputType+"]Expected count to be 11", 11, f2.longValue());
            }
        }
    }

    @Test
View Full Code Here

    // this matches DB2 UDB behaviour

    if (   (localValue.compareTo(MINLONG_MINUS_ONE) == 1)
      && (localValue.compareTo(MAXLONG_PLUS_ONE) == -1)) {

      return localValue.longValue();
    }

    throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "BIGINT");
  }
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.