Python script seems to do incorrect arithmetics.
import _thread
import time
def mult(pixel : int, multiplier : tuple) -> float:
"multiplies either r,g,b pixel by row vector (0.257, 0.504, 0.098),(-0.148,-0.291,0.439),(0.439,-0.368,-0.071))"
sum=0
for mul in multiplier:
sum += (pixel * mul)
print(sum)
return sum
redMul = [0.257, 0.504,0.098]
greenMul = [-0.148, -0.291, 0.439]
blueMul = [0.439, -0.368,-0.071]
redAdd = 16
greenAdd = 128
blueAdd = 128
try:
_thread.start_new_thread(mult,(1,blueMul))
except:
print("Error: unable to start thread")
code outputs:
0.439
0.07100000000000001
1.3877787807814457e-17
when expecting:
0.439
0.071
0
What is the cause of this error and how can i resolve it?