Currently I am trying to convert RGB to HSL. Everything is working but the saturation value. It is always close to the correct value (usually less than 10 off). For example:
RGB:(196,72,84)
HSL:(354,-46,52)
Correct HSL(354,51,53)
How about max and min? Are they doubles, too? If not, then l will probably be calculated incorrectly in line 6 (integer division rather than floating point division).
Line 10 looks wrong. Unless -1/2 < l < +1/2, s will be a negative number. And if l == 1 or 0, then s will be infinite. What equation are you trying to use? We can't read your mind.
And just out of curiosity, why do you have so many decimal places in the constant values in lines 12 and 13? Adding extra '0's at the end of a double doesn't make it any more accurate.