You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting wrong results when I'm using Fxps instantiated from a NumPy Array and given a custom dtype.
The same Fxp instantiated via different ways, even if seemingly exactly the same, produces correct results.
Minimal Example:
import numpy as np
from fxpmath import Fxp
a1 = Fxp(np.array([1.057311]),dtype='Q5.20')
print(f"A1 = {a1[0]}, dtype = {a1[0].dtype}, mem = {a1[0].val}")
a2 = Fxp(1.057311,dtype='Q5.20')
print(f"A2 = {a2}, dtype = {a2.dtype}, mem = {a2.val}")
b = Fxp('7971079',dtype='Q24.20')
print(f"B = {b}, dtype = {b.dtype}")
c = b * a1[0]
print(f"C = {c}, dtype = {c.dtype}")
d = b * a2
print(f"D = {d}, dtype = {d.dtype}")
e = b * Fxp(a1[0],dtype='Q5.20')
print(f"E = {e}, dtype = {e.dtype}")
Output:
A1 = 1.0573101043701172, dtype = fxp-s25/20, mem = 1108670
A2 = 1.0573101043701172, dtype = fxp-s25/20, mem = 1108670
B = 7971079.0, dtype = fxp-s44/20
C = -8349313.630567551, dtype = fxp-s69/40
D = 8427902.36943245, dtype = fxp-s69/40
E = 8427902.36943245, dtype = fxp-s69/40
As can be seen from the output, Fxp A1 produces incorrect multiplication results.
I don't know if it affects different operations besides multiplication and other conditions that have to be met.
The text was updated successfully, but these errors were encountered:
I'm getting wrong results when I'm using Fxps instantiated from a NumPy Array and given a custom dtype.
The same Fxp instantiated via different ways, even if seemingly exactly the same, produces correct results.
Minimal Example:
Output:
As can be seen from the output, Fxp
A1
produces incorrect multiplication results.I don't know if it affects different operations besides multiplication and other conditions that have to be met.
The text was updated successfully, but these errors were encountered: