# Re: [csswg-drafts] [css-color] Should whitepoint and other canonical values be listed in the code section? (#6618)

• From: Isaac Muse via GitHub <sysbot+gh@w3.org>
• Date: Sat, 18 Sep 2021 17:38:19 +0000
• Message-ID: <issue_comment.created-922344908-1631986698-sysbot+gh@w3.org>
```> That said, the bigger problem is when an important constant is not consistent across operations. 0.313, 0.329 is probably fine in most cases, so long as it is used for all transforms in both directions. But mixing 0.313, 0.329 for transforms in one direction and 0.31272, 0.32903 for the other direction, the errors can add up.

Yes, I've run into this before with color conversions. Consistency is key to get the best values, though with floating-point math and more complicated color transforms, you still get some errors, but at least you'll reduce them. I know when calculating HSLuv, from sRGB, the assumption is that 0.3127, 0.3290 is used. The values aren't too clean if you are using something different. You have to download the source algorithm and plug in the new values to generate a solution that gets nice clean results.

What I've been most curious about is the advertising of 5 decimals, but all the examples are given in 4, not the actual precision itself. I can see some people implementing based on the example code and some implementing off the spec value leading to close-ish but different values. What's the point of stating the standard of the white point that should be used if the examples don't even bother using It 🤷🏻? I believe this is unintentional, but it probably should be cleared up.

The 5 decimal sRGB transform should be something more like:

```
--- rgb -> xyz ---
[[0.4124078805165856,  0.35758957376680744, 0.180432597687552  ],
[0.21264781339136446, 0.7151791475336149,  0.07217303907502079],
[0.01933161939921493, 0.11919652458893579, 0.9502783478211071 ]]
```
opposed to the example which is at 4 decimals:

```
--- rgb -> xyz ---
[[0.4123907992659593,  0.357584339383878,   0.18048078840183432],
[0.21263900587151024, 0.715168678767756,   0.07219231536073373],
[0.01933081871559182, 0.11919477979462598, 0.9505321522496608 ]]
```

This goes for all the transforms. Since I'm aware of how to get the calculations, I'm not concerned with not being consistent across conversions, I'm more concerned with what is the actual spec, and is everyone going to implement it differently? If the spec doesn't even use it the same throughout, what hope is there for anyone else 🙂 ?

--
GitHub Notification of comment by facelessuser
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6618#issuecomment-922344908 using your GitHub account

--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
```

Received on Saturday, 18 September 2021 17:38:21 UTC