# How are the various numbers in the standard 2.2 gamma correction for RGB derived?

Here is the standard fwd Gamma 2.22 (1 / 0.45) correction formula:

for R,G,B < 0.018
R´ = 4.5 * R
G´ = 4.5 * G
B´ = 4.5 * B
for R,G,B ≥ 0.018
R´ = 1.099 * R^0.45 - 0.099
G´ = 1.099 * G^0.45 - 0.099
B´ = 1.099 * B^0.45 - 0.099


Where do the figures 0.18, 4.5, 1.099, and 0.099 come from? I specifically need to know how they are derived.

I need to know because I am writing a gamma correction function, and the simple approach of using a power and scaling, rather than the above, yields different results.

-