[Numpy-discussion] Fixed-point arithemetic...any solution yet?

Neal Becker ndbecker2@gmail....
Wed Dec 9 13:26:21 CST 2009

Ruben Salvador wrote:

> Hello everybody.
> I've seen this question arise sometimes on the list, but don't know if
> something has "happened" yet or not. I mean, any solution feasible to use
> more or less right out of the box?
> I'm just a hardware engineer, so it would be difficult for me to create my
> own class for this, since my knowledge of python/numpy is very limited,
> and, just don't have the time/knowledge to be more than a simple user of
> the language, not a developer.
> I have just come across this:
> http://www.dilloneng.com/documents/downloads/demodel/ but haven't used it
> yet. I'll give it a try and see how it works and come back to the list to
> report somehow. But, is there any "official" plans for this within the
> numpy developers? Is there any code around that may be used? I just need
> to test my code with fixed point arithmetic (I'm modelling hardware....)
> Thanks for the good work to all the Python/Numpy developers (and all the
> projects related, matplotlib and so on....) and for the possiblity of
> freeing from matlab!!! I'm determined to do research with as many free
> software design tools as possible....though this fixed-point arithmetic
> issue is still a chain!
> Regards!

I've done some experiments with adding a fixed-pt type to numpy, but in the 
end abandoned the effort.  For now, I use integer arrays to store the data, 
and then just keep variables for the #bits and position of the binary point.

For actual signal processing, I use c++ code.  I have a class that is based 
on boost::constrained_value (unreleased) that gives me the behavior I want 
from fixed point scalars.

More information about the NumPy-Discussion mailing list