Skip to content

Commit

Permalink
Change xyY_to_XYZ function to prevent negative floating point error i…
Browse files Browse the repository at this point in the history
…n some cases.

Python Example:
1 - 0.680 - 0.320 = -5.551115123125783e-17;
1 - (0.680 + 0.320) = 0.0
  • Loading branch information
xuzhaozheng committed Dec 25, 2024
1 parent ec99e04 commit 5005de0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion colour/models/cie_xyy.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def xyY_to_XYZ(xyY: ArrayLike) -> NDArrayFloat:
with sdiv_mode():
Y_y = sdiv(Y, y)

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

return from_range_1(XYZ)

Expand Down

0 comments on commit 5005de0

Please sign in to comment.