# Luv to LCH(uv)

$$L = L$$ $$C = \sqrt{u^2 + v^2}$$ $$H = \cases{ \arctan(v/u) & \text{if }\arctan(v/u) \geq 0 \\ \arctan(v/u) + 360° & \text{otherwise} }$$

Implementation Notes:

1. $H$ is generally expressed in degrees, not radians. Math libraries generally return inverse tangents in radians, not degrees. In Excel, use the DEGREES function to convert radians to degrees.
2. In computing $H$, be careful with the inverse tangent since $u$ could be zero. Instead, use special math functions to do this. In the Standard C library and most other math libraries, this function is called atan2 and is used calling atan2(v, u). In Microsoft Excel, it is called ATAN2 and its use is ATAN2(u, v). Note the argument reversal! These special functions will compute the proper inverse tangents without needing to worry about "divide by zero" conditions. Additionally, atan2 will also handle the quadrants for you.