-
Notifications
You must be signed in to change notification settings - Fork 20
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
pow() of Fxp unsigned values does not work #17
Comments
On the second thought, the resulting sign depends on |
Hi, About the You can get the integer size of Fxp using All of these makes me thing that this method is not supporting float or negative exponents ( About your second thought, it is not convenient return a signed or not signed object depending its val. The philosophy I choose for fxpmath is to maintain the signed type of Fxp regardless its value. I imagine that all of these changes will be included in next release (soon) |
Oh, I've noticed that my fix #18 also does not consider the cases there power n is negative. As I understand in those cases only the fractional part should be extended. |
well, I update the repo and release. Obs: please check in your solution if the following case works: x = Fxp(-16)
y = x ** 2
assert y() == 256 I think one bit is missing in your solution. Tell me please if v0.3.8 is working for you. |
Hi! First of all, thanks for this module, great work!
I've noticed, that Fxp does not support the power of unsigned values. The following example
Generates traceback:
Which is, obviously, because integer n does not have a
signed
field :) I think thator n.signed
is not needed here, because the sign of the number in pow does not affect the resulting sign.I also suppose that the __pow__ method does not generate correct
n_word
bit size for signed values. Rigth now it multiplies sign bit by n, which is not needed. I assume it should be like:But I haven't tested it yet.
The text was updated successfully, but these errors were encountered: