fork download
  1. function H=r(c) [b,i]=sort(c);h=60*[6*(i(1)~=3),2,4](i);H=(h(3)-h(2))*(1+(b(3)-b(2))/(b(3)-b(1)))/2+h(2);
  2.  
  3. end % only necessary to separate function from test driver in the same file
  4.  
  5. r1=r([0 182 255])
  6. r2=r([127 247 103])
  7. r3=r([0 0 1])
  8. r4=r([255 165 245])
Success #stdin #stdout 0.17s 65056KB
stdin
Standard input is empty
stdout
r1 =  197.18
r2 =  110.00
r3 =  240
r4 =  306.67