Closed volrak closed 11 months ago
Hi @volrak,
Thank you, this is rather unfortunate the subtraction produces that. I'm wondering if we should not take the absolute value rather than clamping to zero. I will check if the CIE has some recommendations for that.
Cheers,
Thomas
Implementation note from Bruce Lindbloom:
Looked at most implementations and everybody seems to be clamping. I have seen only one implementation that takes the absolute value.
Description
Certain values passed into
delta_E_CIE1994()
cause an exception or nan result.The cause looks like rounding of intermediate floating point values resulting in a square root of a negative number. For the example inputs in the reproduction section, the argument to
sqrt
is:A likely fix seems be to enforce a lower bound of 0 on this expression before the sqrt.
Code for Reproduction
Exception Message
Environment Information