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

Creation of Fxp-object with negative n_frac #80

Closed
alb-pol opened this issue Mar 23, 2023 · 2 comments
Closed

Creation of Fxp-object with negative n_frac #80

alb-pol opened this issue Mar 23, 2023 · 2 comments

Comments

@alb-pol
Copy link

alb-pol commented Mar 23, 2023

The following code results in unexpected behaviour when trying to specify the same type using alternative formats :

x = Fxp(16, signed=True, n_word=8, n_frac=-2)
-> x.dtype = 'fxp-s8/-2' , ok

x = Fxp(16, dtype='S10.-2')
-> x.dtype = 'fxp-s10/0' , why? expected x.dtype= 'fxp-s8/-2'

x = Fxp(16, dtype='fxp-s8/-2')
-> error message

Traceback (most recent call last):
File "", line 1, in
File "c:\Projects\MA-pyrdf.venv\lib\site-packages\fxpmath\objects.py", line 222, in init
signed, n_word, n_frac, complex_flag = self._parseformatstr(dtype)
File "c:\Projects\MA-pyrdf.venv\lib\site-packages\fxpmath\objects.py", line 348, in _parseformatstr
raise ValueError('unrecognized format string')
ValueError: unrecognized format string

@francof2a
Copy link
Owner

Hello,
I could replicate the bug. The problem is that the dtype string parsing does not support negative numbers.
This will be fixed in next version (v0.4.9).
Thank you for the issue report!

@francof2a
Copy link
Owner

solved in v0.4.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants