@Override
	public byte[] encodeValue(Object value, MemBuffer buf, Settings settings, int length)
			throws DataTypeEncodeException {
		// value expected as Number or BigFloat object
		try {
			int len = getLength();
			if (floatFormat == null) {
				throw new DataTypeEncodeException(
					"Unsupported float format (" + len + " bytes)", value, this);
			}
			if ((len == 8 || len == 4) && (value instanceof Number)) {
				double doubleValue = ((Number) value).doubleValue();
				long encoding = floatFormat.getEncoding(doubleValue);
				return Utils.longToBytes(encoding, len, buf.isBigEndian());
			}
			if (!(value instanceof BigFloat)) {
				throw new DataTypeEncodeException(
					"non-standard float length requires BigFloat type", value, this);
			}
			BigInteger encoding = floatFormat.getEncoding((BigFloat) value);
			return Utils.bigIntegerToBytes(encoding, len, buf.isBigEndian());
		}
		catch (DataTypeEncodeException e) {
			throw e;
		}
		catch (Exception e) {
			throw new DataTypeEncodeException(value, this, e);
		}
	}
Get the encoded length (number of 8-bit bytes) of this float datatype.

@return encoded length of this float datatype.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractFloatDataType.java