I made a simple linear equation system solver using NumPy arrays. I have two arrays on hand: a 2x2 (A) one and a 2x1 one (B).
By inverting the first one using Ainv = np.linalg.inv(A) and then multiplying it with the second one using Ainv.dot(B), I get a third 2x1 array with my desired x and y values, which is returned by the function, called solveLin() by the way.
Now if I print out print(solveLin()) with the variables in place, I do get the array [[-8.]
[ 5.]] with the correct values.
However, if I target the values with print(solveLin()[0][0]) for example, I get -7.999999999999998 and 4.999999999999999 as my answers.
If I set them to display as integers, they become -7 and 4
Edit: I do understand why floating numbers act this way, but I do not understand why are they displayed one way in the array and then another way when called directly.
 
     
    