Lab to LCH(ab)

$$L = L$$ $$C = \sqrt{a^2 + b^2}$$ $$H = \cases{ \arctan(b/a) & \text{if }\arctan(b/a) \geq 0 \\ \arctan(b/a) + 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 $a$ 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(b, a). In Microsoft Excel, it is called ATAN2 and its use is ATAN2(a, b). 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.