calculate k with one fewer divide

Updated the tests to print out how close we are to roundtripping 1.0f.

With this change, the computed inverses actually become closer to the
goal than the current hardcoded inverse:

    ~/skcms (master↑1|✔) $ out/clang/tests
    0x1.fff50ap-1 0.999916, -1403 ulps from 1.0f   (hardcoded)
    0x1.0001p+0 1.00002, 128 ulps from 1.0f        (sRGB2)
    0x1.fffc0ap-1 0.99997, -507 ulps from 1.0f     (inv2)

This a^-g version also beats 1/(a^g).

Since this quality is now better than the hardcoded version, I'm
thinking of removing the hardcoded sRGB inverse and replacing it with a
once'd runtime call to invert.  That'd at least make the two obvious
ways of getting at the inverse sRGB curve agree exactly.


Change-Id: Ic6b301b30747b2483e5354a5cbf18065e6ef0e07
Reviewed-by: Brian Osman <>
Commit-Queue: Mike Klein <>
43 files changed