Representing fractional values as scaled integers. On MCUs without an FPU (Cortex-M0+, many RISC-V parts), floating point is emulated in software — slow and non-deterministic. Fixed-point is exact, fast, and deterministic.

Q format: Qm.n means m integer bits, n fractional bits. Q15 means 1 sign bit + 0 integer bits + 15 fractional bits — values in [-1, 1) with resolution 2^-15 ≈ 0.0000305.

// Q15 fixed-point: value = raw / 32768.0
type Q15 = i16;

fn q15_mul(a: Q15, b: Q15) -> Q15 {
    // Multiply → 32-bit result, shift back to Q15
    ((a as i32 * b as i32) >> 15) as i16
}

fn q15_from_f32(x: f32) -> Q15 {
    (x * 32768.0) as i16
}

// FIR filter in Q15
fn fir_filter(input: Q15, coeffs: &[Q15], state: &mut [Q15]) -> Q15 {
    state.rotate_right(1);
    state[0] = input;
    state.iter().zip(coeffs.iter())
        .map(|(&s, &c)| q15_mul(s, c))
        .fold(0i16, |acc, x| acc.saturating_add(x))
}

Used in PulsarSync-Core for the dispersion measure correction filter — computing frequency-dependent time delays without FPU. On Cortex-M0+, a Q15 multiply is 2-3 cycles vs 20-40 cycles for software-emulated float.

For NeuralEdge: Neural network weights quantised to INT8 (range -128 to 127, representing -1.0 to ~1.0) reduce model size by 4x vs float32 and enable SIMD operations — 4 INT8 multiplies per 32-bit operation on Cortex-M55 with Helium.