Skip to content

Commit 87ea299

Browse files
xuzhaozhengKelSolaar
authored andcommitted
Change xyY_to_XYZ function to prevent negative floating point error in some cases.
Python Example: 1 - 0.680 - 0.320 = -5.551115123125783e-17; 1 - (0.680 + 0.320) = 0.0
1 parent b6e099c commit 87ea299

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

colour/models/cie_xyy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def xyY_to_XYZ(xyY: ArrayLike) -> NDArrayFloat:
149149
with sdiv_mode():
150150
Y_y = sdiv(Y, y)
151151

152-
XYZ = tstack([x * Y_y, Y, (1 - x - y) * Y_y])
152+
XYZ = tstack([x * Y_y, Y, (1 - (x + y)) * Y_y])
153153

154154
return from_range_1(XYZ)
155155

0 commit comments

Comments
 (0)