Skip to content

Creating a File With Float 16

Selfeer edited this page Dec 13, 2024 · 1 revision

Float16

In Apache Parquet, the Float16 datatype represents a 16-bit floating-point number. It's a smaller and less precise version of the standard 32-bit floating-point number (Float32) or 64-bit floating-point number (Float64). Key Points:

  • Size: Float16 uses only 16 bits (2 bytes), making it more compact compared to Float32 or Float64.
  • Precision: It has less precision and a smaller range than Float32, so it's not ideal for very detailed or large numerical data.
  • Use Case: Float16 is often used when memory and storage are critical, such as in machine learning models or graphics, where very high precision isn't necessary.

A Float16 can store numbers like 1.5 or 0.001, but it may lose precision for very large or very small numbers.

Example:

Full example here

    {
  "name": "floatfield",
  "schemaType": "required",
  "physicalType": "FIXED_LEN_BYTE_ARRAY",
  "length": 2,
  "logicalType": "FLOAT16",
  "data": [
    -2,
    -1,
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9
  ]
}

Note

Here length is the specified length of the FIXED_LEN_BYTE_ARRAY which is 16 for the given uuid values.

Clone this wiki locally