File Exchange

image thumbnail

Canonical Signed Digits

version (1.95 KB) by Patrick Moran
Generates a CSD representation of a floating point number.


Updated 24 Jan 2006

No License

Canonical-signed-digit (CSD) coefficient representations of floating point numbers lead to efficient add/subtract networks for hardwired DSP multiplies of two?s complement signals.

example csdigit(23) returns +0-00-.
Where +0-00-. is a representation of +1 in 2^5, -1 in 2^3 and -1 in 2^0 positions.
i.e. 23 = 32 - 8 - 1

example [a,p,n]=csdigit(23.5,6,2) returns
a = +0-000.-0
23.5 = 32 - 8 - 0.5

Cite As

Patrick Moran (2021). Canonical Signed Digits (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)


Really useful.


When the precision is not enough, I suggest to use "round" instead of "floor" to get better approximation.

Rolo oloR

This is simple and easy to use.

anantha gunnala

very useful

paramasivam chinnusamy

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!