The formulas in the link from donalfredo seems to be very similiar to Wojtec. I did some research for myself. I get also very similiar results from photoshop as wojtec depending on which profiles i set. I think the differences come from the adobe colormanagement engine. So the photoshop does a full color space conversion between icc profiles and such approximation formulas like "C:=1-(R/255)..." don't work any more.
jus