ArticleslgStudy

mathematics

Q (number format)

Q (number format) is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Q (number format) rather than just read about it. In short: The Q notation is a way to specify the parameters of a binary fixed point number format. Specifically, how many bits are allocated for the integer portion, how many for the fractional portion, and whether there is a sign-bit.

Key takeaways

  • Q (number format) belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Q (number format) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Q (number format) from memory before moving on to harder problems.

Reference excerpt

The Q notation is a way to specify the parameters of a binary fixed point number format. Specifically, how many bits are allocated for the integer portion, how many for the fractional portion, and whether there is a sign-bit. For example, in Q notation, Q7.8 means that the signed fixed point numbers in this format have 7 bits for the integer part and 8 bits for the fraction part. One extra bit is implicitly added for signed numbers. Therefore, Q7.8 is a 16-bit word, with the most significant bit representing the two's complement sign bit.

There is an ARM variation of the Q notation that explicitly adds the sign bit to the integer part. In ARM Q notation, the above format would be called Q8.8. A number of other notations have been used for the same purpose.

Definition

General Format

U ⏟ u n s i g n e d Q m ⏟ i n t e g e r . n ⏟ f r a c t i o n {\displaystyle \underbrace {\mathrm {U} } _{\mathrm {\scriptscriptstyle unsigned} }\;\mathbf {Q} \;\underbrace {m} _{\mathrm {\scriptscriptstyle integer} }\;\;\mathbf {.} \;\underbrace {n} _{\mathrm {\scriptscriptstyle fraction} }}

Texas Instruments version The Q notation, as defined by Texas Instruments, consists of the letter Q followed by a pair of numbers m.n, where m is the number of bits used for the integer part of the value, and n is the number of fraction bits. By default, the notation describes signed binary fixed point format, with the unscaled integer being stored in two's complement format, used in most binary processors. As such, the first bit always gives the sign of the value (1 = negative, 0 = non-negative), and it is not counted in the m parameter. Thus, the total number w of bits used is 1 + m + n. For example, the specification Q3.12 describes a signed binary fixed-point number with word-size w = 16 bits in total, comprising the sign bit, three bits for the integer part, and 12 bits that are the fraction. This can be seen as a 16-bit signed (two's complement) integer, that is implicitly multiplied by the scaling factor 2 − 12 {\displaystyle 2^{-12}} . In particular, when n is zero, the numbers are just integers. If m is zero, all bits except the sign bit are fraction bits; then the range of the stored number is from −1.0 (inclusive) to +1.0 (exclusive). The m and the dot may be omitted, in which case they are inferred from the size of the variable or register where the value is stored. Thus, Q12 means a signed integer with any number of bits, that is implicitly multiplied by 2 − 12 {\displaystyle 2^{-12}} . The letter U can be prefixed to the Q to denote an unsigned binary fixed-point format. For example, UQ1.15 describes values represented as unsigned 16-bit integers with an implicit scaling factor of 2 − 15 {\displaystyle 2^{-15}} , which range from 0.0 {\displaystyle 0.0} to ( 2 16 − 1 ) / 2 15 = + 1.999969482421875 {\displaystyle (2^{16}-1)/2^{15}=+1.999969482421875} .

ARM version A variant of the Q notation has been in use by ARM in which the m number also counts the sign bit. For example, a 16-bit signed integer which the TI variant denotes as Q15.0, would be Q16.0 in the ARM variant. Unsigned numbers are the same across both variants. While technically the sign-bit belongs just as much to the fractional part as the integer part, ARM's notation has the benefit that there are no implicit bits, so the size of the word is always m + n bits {\displaystyle m+n\ {\textrm {bits}}} .

Characteristics The resolution (difference between successive values) of a Qm.n or UQm.n format is always 2−n. The range of representable values depends on the notation used:

For example, a Q14.1 format number requires 14+1+1 = 16 bits, has resolution 2−1 = 0.5, and the representable values range from −214 = −16384.0 to +214 − 2−1 = +16383.5. In hexadecimal, the negative values range from 0x8000 to 0xFFFF followed by the non-negative ones from 0x0000 to 0x7FFF.

Math operations Q numbers are a ratio of two integers: the numerator is kept in storage, the denominator d {\displaystyle d} is equal to 2n. Consider the following example:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Q (number format)

Start with the simplest possible case. Write down what Q (number format) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Q (number format) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Q (number format) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Q (number format)

In research
Q (number format) appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Q (number format) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Q (number format) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Q (number format) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Q (number format)” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Q (number format) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Q (number format) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Q (number format) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Q (number format) in simple terms?

The Q notation is a way to specify the parameters of a binary fixed point number format. Specifically, how many bits are allocated for the integer portion, how many for the fractional portion, and whether there is a sign-bit.

Why does Q (number format) matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Q (number format)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Q (number format).

Tags

  • Computer arithmetic

Keep exploring