public static LuaValue longBitsToLuaNumber(long bits) {
		if ((bits & ((1L << 63) - 1)) == 0L) {
			return LuaValue.ZERO;
		}

		int e = (int) ((bits >> 52) & 0x7ffL) - 1023;

		if (e >= 0 && e < 31) {
			long f = bits & 0xFFFFFFFFFFFFFL;
			int shift = 52 - e;
			long intPrecMask = (1L << shift) - 1;
			if ((f & intPrecMask) == 0) {
				int intValue = (int) (f >> shift) | (1 << e);
				return LuaInteger.valueOf(((bits >> 63) != 0) ? -intValue : intValue);
			}
		}

		return LuaValue.valueOf(Double.longBitsToDouble(bits));
	}