T to xy

Here are the equations to convert from the correlated color temperature of a CIE D-illuminant to the chromaticity of that D-illuminant.

$$x_D = \cases{{{{-4.6070 \times 10^9} \over {T^3}} + {{2.9678 \times 10^6} \over {T^2}} + {{0.09911 \times 10^3} \over {T}} + 0.244063} & \text{if }4000K \leq T \leq 7000K \\ {{{-2.0064 \times 10^9} \over {T^3}} + {{1.9018 \times 10^6} \over {T^2}} + {{0.24748 \times 10^3} \over {T}} + 0.237040} & \text{if }7000K \lt T \leq 25000K}$$ $$y_D = -3.000 {x_D}^2 + 2.870 x_D - 0.275$$