Q auto-suggest

Recommend a Q-factor from sample data. Two modes: recover Q when you have both a float reference and the fixed-point integers (mirrors the Debugger's per-row Auto-Q button); pick Q when you only have a float signal and a target Word width.

๐Ÿ“‚ Drop float values file (or click)
๐Ÿ“‚ Drop fixed integers file (or click)
Plot
0
Float Fixed (recovered) Diff (ร—1)

How "recover" works

For each pair where the float reference is non-zero, compute ratioi = fixedi / floati. Since fixed = float ยท 2Q for the matching Q-format, the ratios cluster around 2Q. Take the mean of the positive finite ratios, log2 it, and round โ€” that's your Q. The standard deviation across ratios indicates how confident the suggestion is (low ฯƒ โ‡’ a single consistent Q produced the data).

How "pick" works

Take max|x| across the float samples. The smallest integer E with 2E > max|x| is the number of integer bits needed to represent the signal without saturating the positive peak; Q = (N โˆ’ 1) โˆ’ E. The result is the tightest Q for that Word width โ€” i.e. the most fractional precision you can afford.

โ† All tools