[New-bugs-announce] [issue40668] Catastrophic loss of precision in colorsys module
Zac Hatfield-Dodds
report at bugs.python.org
Mon May 18 05:10:27 EDT 2020
New submission from Zac Hatfield-Dodds <zac.hatfield.dodds at gmail.com>:
As part of the Mentored Sprints at PyCon US, Marielle wrote some property-based tests [1] for the colorsys module [2], which found two bugs.
Taking a YIQ color, converting to RGB, and back to YIQ can result in the Y coordinate varying by more 0.1 (where [0, 1] is the range of possible values).
For example: (0.0 1.0 2.2204460492503136e-16) -> RGB -> (0.0 1.1102230246251568e-16 1.0)
Taking an RGB color and converting though HSV-RBG-HSV can result in very different saturation values - up to having S1==0 and S2==1.
For example: (0.0 1.0 2.2204460492503136e-16) -> RGB -> (0.0 1.1102230246251568e-16 1.0)
You can reproduce additional examples and get error bounds from [3].
[1] https://pyfound.blogspot.com/2020/05/property-based-testing-for-python.html
[2] https://docs.python.org/3/library/colorsys.html
[3] https://github.com/Zac-HD/stdlib-property-tests/pull/13
----------
components: Library (Lib)
messages: 369197
nosy: Zac Hatfield-Dodds
priority: normal
severity: normal
status: open
title: Catastrophic loss of precision in colorsys module
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40668>
_______________________________________
More information about the New-bugs-announce
mailing list