Predefined Microfloats

Microfloats defines and exports a set of common types.

IEEE-like

These types have IEEE 754-like Inf/NaN encodings, with Inf being represented as all 1s in the exponent and a significand of zero, and NaN being represented as all 1s in the exponent and a non-zero significand.

Microfloats.Float8_E5M2Type
Float8_E5M2

Properties

  • Bits: 1 sign + 5 exponent + 2 significand (8 total)
  • Has Inf: true
  • Has NaN: true
  • Non-finite behavior: Microfloats.IEEE
  • Overflow policy: Microfloats.Overflowing()
  • Max normal: 57344.0
  • Min normal: 6.103515625e-5
  • Max subnormal: 4.57763671875e-5
  • Min subnormal: 1.52587890625e-5
source
Microfloats.Float8_E4M3Type
Float8_E4M3

Properties

  • Bits: 1 sign + 4 exponent + 3 significand (8 total)
  • Has Inf: true
  • Has NaN: true
  • Non-finite behavior: Microfloats.IEEE
  • Overflow policy: Microfloats.Overflowing()
  • Max normal: 240.0
  • Min normal: 0.015625
  • Max subnormal: 0.013671875
  • Min subnormal: 0.001953125
source
Microfloats.Float8_E3M4Type
Float8_E3M4

Properties

  • Bits: 1 sign + 3 exponent + 4 significand (8 total)
  • Has Inf: true
  • Has NaN: true
  • Non-finite behavior: Microfloats.IEEE
  • Overflow policy: Microfloats.Overflowing()
  • Max normal: 15.5
  • Min normal: 0.25
  • Max subnormal: 0.234375
  • Min subnormal: 0.015625
source

Finite

These types have no Inf encoding, with alternate or no NaN encodings at all.

Microfloats.Float8_E4M3FNType
Float8_E4M3FN

Properties

  • Bits: 1 sign + 4 exponent + 3 significand (8 total)
  • Has Inf: false
  • Has NaN: true
  • Non-finite behavior: Microfloats.NanOnlyAllOnes
  • Overflow policy: Microfloats.Overflowing()
  • Max normal: 448.0
  • Min normal: 0.015625
  • Max subnormal: 0.013671875
  • Min subnormal: 0.001953125
source
Microfloats.Float8_E8M0FNUType
Float8_E8M0FNU

Properties

  • Bits: 0 sign + 8 exponent + 0 significand (8 total)
  • Has Inf: false
  • Has NaN: true
  • Non-finite behavior: Microfloats.NanOnlyAllOnes
  • Overflow policy: Microfloats.Overflowing()
  • Max normal: 1.7014118346046923e38
  • Min normal: 5.877471754111438e-39
  • Max subnormal: N/A
  • Min subnormal: N/A
source
Microfloats.Float6_E3M2FNType
Float6_E3M2FN

Properties

  • Bits: 1 sign + 3 exponent + 2 significand (6 total)
  • Has Inf: false
  • Has NaN: false
  • Non-finite behavior: Microfloats.FiniteOnly
  • Overflow policy: Microfloats.Saturating()
  • Max normal: 28.0
  • Min normal: 0.25
  • Max subnormal: 0.1875
  • Min subnormal: 0.0625
source
Microfloats.Float6_E2M3FNType
Float6_E2M3FN

Properties

  • Bits: 1 sign + 2 exponent + 3 significand (6 total)
  • Has Inf: false
  • Has NaN: false
  • Non-finite behavior: Microfloats.FiniteOnly
  • Overflow policy: Microfloats.Saturating()
  • Max normal: 7.5
  • Min normal: 1.0
  • Max subnormal: 0.875
  • Min subnormal: 0.125
source
Microfloats.Float4_E2M1FNType
Float4_E2M1FN

Properties

  • Bits: 1 sign + 2 exponent + 1 significand (4 total)
  • Has Inf: false
  • Has NaN: false
  • Non-finite behavior: Microfloats.FiniteOnly
  • Overflow policy: Microfloats.Saturating()
  • Max normal: 6.0
  • Min normal: 1.0
  • Max subnormal: 0.5
  • Min subnormal: 0.5
source