Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter Notebook example OverflowError raised #227

Open
ChrisXtrac opened this issue Jan 6, 2025 · 1 comment
Open

Jupyter Notebook example OverflowError raised #227

ChrisXtrac opened this issue Jan 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ChrisXtrac
Copy link

ChrisXtrac commented Jan 6, 2025

When using the Python wrapper jupyter notebook example the following error is raised "OverflowError: Python integer 32768 out of bounds for int16".
I've tracked it down to a possible bug in the file cmsisdsp/fixedpoint.py.
The q15sat function looks like it needs a sign added to the negative saturation logic as shown below and I also think this need to be added to the other saturation functions.

The system was as follows:

  • Windows 10
  • Python 3.12.6
  • cmsisdsp 1.9.9
  • Numpy 2.0.0
def q15sat(x):
     if x > 0x7FFF:
          return(np.int16(0x7FFF))
     elif x < -0x8000:
          return(np.int16(-0x8000))
     else:
          return(np.int16(x))
@christophe0606
Copy link
Contributor

@ChrisXtrac Perhaps I'll remove those convenience functions in the future because you can use the equivalent CMSIS-DSP function. For instance:

dsp.arm_float_to_q15([0.9])

Only difference is that it is using arrays.

I agree the fixedpoint.py functions need more testing.

@christophe0606 christophe0606 added the bug Something isn't working label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants