# OpenStax_CNX

You are here: Home » Content » Fixed Point Arithmetic and Q format

## Navigation

### Recently Viewed

This feature requires Javascript to be enabled.

# Fixed Point Arithmetic and Q format

Module by: Hyeokho Choi. E-mail the author

Summary: This module explains the fixed point, finite-precision fractional number representation.

## Fractional Number Representation and Q Format

Using 2's compliment integer representation, we can implement both addition and subtraction by usual binary addition (with special care for the sign bit). However, the integers are not convenient to handle to implement common DSP algorithms. For example, if we multiply two 8-bit words together, we need 16 bits to store the result. The number of required word length increases without bound as we multiply numbers together. Although not impossible, it is complicated to handle this increase in word length using integer arithmetic.

Instead, by using fractional numbers between -1 and 1, we can easily handle the results of multiplication because the product of two numbers is always in the same range.

In the 2's complement fractional representation, an NN bit binary word can represent equally spaced 2N 2 N numbers from 2N12N1=-1 2 N 1 2 N 1 -1 to 2N112N1=12(N1) 2 N 1 1 2 N 1 1 2 N 1 . For example, we interpret an 8-bit binary word b_7b_6b_5b_4b_3b_2b_1b_0 as a fractional number

(1)

This representation is also called Q-format representation. We can think of having an implied binary point right after the MSB. If we have an N-bit binary word with MSB as the sign bit, we have N-1 bits to represent the fractional magnitude. We say the number has Q-(N-1) format representation. In 32bit DSP processor such as TI TMS320C62x, it is easiest to handle Q-15 format numbers represented by each 16-bit binary word, because the product of two Q-15 numbers is a Q-30 number that can still be stored in a 32-bit register. The programmer needs to keep track of the implied binary point when multiplying the Q format numbers.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

### Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

### Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

### Reuse / Edit:

Reuse or edit module (?)

#### Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

#### Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.