Closed SDH0531 closed 1 year ago
Yes for stability it should be multiplication before division, otherwise we run into FP issues.
PR welcome.
Hi Florian That's right, this problem caused by performing division first. Therefore, this problem can be solved by simply performing the multiplication first. Thanks
If value is between 0.0 and 1.0, why wouldn't you just do return (byte)(255.0 * value);
? Or am I missing something?
[AngleSharp.CSS v0.17.0]
If the color is specified in % like "RGB(100%,100%,100%);", the RGB value will be 254 instead of 255. I checked the source code, the calculation of the color value was as follows.
ColorParser.cs(217) return (Byte)(255f / 100f * value);
With this, even if the value is 100, the result will be 254. I don't think this is the correct behavior.