protected static Number toNumber(BigDecimal bd){
		String s = bd.toString();
		int dot = s.indexOf('.'), e = s.indexOf('E', dot+1);
		//change e to the end if there is no exponent
		if(e == -1) e = s.length();
		//change dot to e if there is no dot
		if(dot == -1) dot = e;
		String integer = s.substring(bd.signum() == -1 ? 1 : 0, dot);
		String decimal = dot >= e ? null : s.substring(dot+1, e);
		Integer sciExponent = null;
		//+2 takes care of the 'e' and sign characters, e.g. "e+3"; multiplying by -1 accounts for the sign
		if(e < s.length()) sciExponent = new Integer(s.substring(e+2)) * (s.charAt(e+1) == '-' ? -1 : 1);
		//set the sign for the sciExponent
		return new Number(bd.signum() == -1 ? false : true, integer, decimal, sciExponent, 1);
	}