Will get the value as a string and return a BigDecimal value
for long precision instead of Double value.
196436
public BigDecimal getValueAsBigDecimal() {
        String value = (String) $(valueBoxBase.getElement()).val();
        if (value != null && !value.isEmpty()) {
            return new BigDecimal(value);
        } else {
            return null;
        }
    }
220395
public static String doubleToGoString(double d) {
    if (d == Double.POSITIVE_INFINITY) {
      return "+Inf";
    } 
    if (d == Double.NEGATIVE_INFINITY) {
      return "-Inf";
    }
    if (Double.isNaN(d)) {
      return "NaN";
    }
    return Double.toString(d);
  }
1069832
private String getDataType(final Value value) {
        if (value instanceof BigDecimalValue) {
            return DataType.TYPE_NUMERIC_BIGDECIMAL;
        } else if (value instanceof BigIntegerValue) {
            return DataType.TYPE_NUMERIC_BIGINTEGER;
        } else if (value instanceof BooleanValue) {
            return DataType.TYPE_BOOLEAN;
        } else if (value instanceof ByteValue) {
            return DataType.TYPE_NUMERIC_BYTE;
        } else if (value instanceof DateValue) {
            return DataType.TYPE_DATE;
        } else if (value instanceof DoubleValue) {
            return DataType.TYPE_NUMERIC_DOUBLE;
        } else if (value instanceof FloatValue) {
            return DataType.TYPE_NUMERIC_FLOAT;
        } else if (value instanceof IntegerValue) {
            return DataType.TYPE_NUMERIC_INTEGER;
        } else if (value instanceof LongValue) {
            return DataType.TYPE_NUMERIC_LONG;
        } else if (value instanceof ShortValue) {
            return DataType.TYPE_NUMERIC_SHORT;
        } else if (value instanceof EnumValue) {
            return DataType.TYPE_COMPARABLE;
        }

        return DataType.TYPE_STRING;
    }
469147
public static long toLongValue(String str) throws PageException {
	BigInteger bi = null;
	try {
	    bi = new BigInteger(str);

	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	}
	if (bi != null) {
	    if (bi.bitLength() < 64) return bi.longValue();
	    throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)");
	}
	return (long) toDoubleValue(str);
    }
209281
public int precision() {
        int result = precision;
        if (result == 0) {
            long s = intCompact;
            if (s != INFLATED)
                result = longDigitLength(s);
            else
                result = bigDigitLength(intVal);
            precision = result;
        }
        return result;
    }
1190901
@Override
    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            final VoltType type = table.getColumnType(columnIndex - 1);
            BigDecimal decimalValue = null;
            switch(type) {
            case TINYINT:
                decimalValue = new BigDecimal(table.getLong(columnIndex - 1));
                break;
            case SMALLINT:
                decimalValue = new BigDecimal(table.getLong(columnIndex - 1));
                break;
            case INTEGER:
                decimalValue = new BigDecimal(table.getLong(columnIndex - 1));
                break;
            case BIGINT:
                decimalValue = new BigDecimal(table.getLong(columnIndex - 1));
                break;
            case FLOAT:
                decimalValue = new BigDecimal(table.getDouble(columnIndex - 1));
                break;
            case DECIMAL:
                decimalValue = table.getDecimalAsBigDecimal(columnIndex - 1);
                break;
            default:
                throw new IllegalArgumentException("Cannot get BigDecimal value for column type '" + type + "'");
            }

            return table.wasNull() ? null : decimalValue;
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
149648
private BigDecimal convertValue(final Object value) {
		if (value == null) {
			return null;
		} else if (value instanceof BigDecimal) {
			return (BigDecimal) value;
		}

		// Try and convert "String" value
		String dataString = value.toString();
		if (Util.empty(dataString)) {
			return null;
		}

		try {
			return new BigDecimal(dataString);
		} catch (NumberFormatException ex) {
			throw new SystemException(
					"Could not convert data of type " + value.getClass() + " with String value "
					+ dataString + " to BigDecimal", ex);
		}
	}
944591
def bigint_to_string(val):
    
    if isinstance(val, _NUMBERS) and not abs(val) <= 2**53-1:
        return str(val)
    return val
376627
def exact(cls, value, precision=None):
        
        # figure out precision to use
        if isinstance(value, six.string_types):
            if precision is None:
                raise TypeError("precision must be supplied when "
                                "converting from a string")
        else:
            if precision is not None:
                raise TypeError("precision argument should not be "
                                "specified except when converting "
                                "from a string")
            if isinstance(value, float):
                precision = _builtin_max(DBL_PRECISION, PRECISION_MIN)
            elif isinstance(value, six.integer_types):
                precision = _builtin_max(_bit_length(value), PRECISION_MIN)
            elif isinstance(value, BigFloat):
                precision = value.precision
            else:
                raise TypeError("Can't convert argument %s of type %s "
                                "to BigFloat" % (value, type(value)))

        # Use unlimited exponents, with given precision.
        with _saved_flags():
            set_flagstate(set())  # clear all flags
            context = (
                WideExponentContext +
                Context(precision=precision) +
                RoundTiesToEven
            )
            with context:
                result = BigFloat(value)
            if test_flag(Overflow):
                raise ValueError("value too large to represent as a BigFloat")
            if test_flag(Underflow):
                raise ValueError("value too small to represent as a BigFloat")
            if test_flag(Inexact) and not isinstance(value, six.string_types):
                # since this is supposed to be an exact conversion, the
                # inexact flag should never be set except when converting
                # from a string.
                assert False, ("Inexact conversion in BigFloat.exact. "
                               "This shouldn't ever happen.  Please report.")

        return result
27104
def _to_str(self, value, field_begin, field_len):
        
        value_str = '{0:0{1}d}'.format(value, field_len)
        if self.precision is not None and \
                self.precision < field_begin + field_len:
            # field is partly or completely affected by precision
            # -> replace insignificant digits with asterisks
            precision_index = max(0, self.precision - field_begin)
            value_str = value_str[:precision_index] + \
                '*' * (field_len - precision_index)
        return value_str
818945
private static long getScaledValue(FileBuffer buffer, int scale,
                                       long position)
        throws IOException
    {
        return getScaledValue(new byte[8], buffer, scale, position);
    }
306763
static public String doubleToString(double d) {
    if (Double.isInfinite(d) || Double.isNaN(d)) {
      return "null";
    }

    // Shave off trailing zeros and decimal point, if possible.

    String s = Double.toString(d);
    if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
      while (s.endsWith("0")) {
        s = s.substring(0, s.length() - 1);
      }
      if (s.endsWith(".")) {
        s = s.substring(0, s.length() - 1);
      }
    }
    return s;
  }
634688
public static Double asDouble(Object value) {
    double doubleValue;
    switch (value.getClass().getCanonicalName()) {
      case "java.math.BigDecimal":
        doubleValue = ((BigDecimal) value).doubleValue();
        break;
      case "java.lang.Integer":
        doubleValue = ((Integer) value).doubleValue();
        break;
      default:
        doubleValue = (Double) value;
        break;
    }
    return doubleValue;
  }
1245156
def decimal_from_string(value)
      Float(value)
      BigDecimal(value, digits)
    rescue ArgumentError
      raise InvalidValueError, "Given value: #{value.inspect}"
    end
352374
static Long convertToLong(SessionInterface session, Object a) {

        if (a instanceof Integer) {
            return ValuePool.getLong(((Integer) a).intValue());
        } else if (a instanceof Long) {
            return (Long) a;
        } else if (a instanceof BigDecimal) {
            BigDecimal bd = (BigDecimal) a;

            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) {
                    d = java.lang.Math.rint(d);
                }
            }

            if (Double.isInfinite(d) || Double.isNaN(d)
                    || d >= (double) Long.MAX_VALUE + 1
                    || d <= (double) Long.MIN_VALUE - 1) {
                throw Error.error(ErrorCode.X_22003);
            }

            return ValuePool.getLong((long) d);
        } else {
            throw Error.error(ErrorCode.X_42561);
        }
    }
1302829
private long getLongValue(String sLong) {
        long ret;
        try {
            ret = Long.valueOf(sLong);
        } catch (Exception ex) {
            ret = -1;
        }
        return Math.max(ret, -1);
    }
1048596
public BigDecimal toBigDecimal() {

        StringBuilder sb = new StringBuilder();
        this.createNumber(sb);
        return new BigDecimal(sb.toString());

    }