Having trouble implementing a function in the node editor where the source uses if/else logic
Rewrite the code as
h1 =     (g - b) / delta;  // between yellow &amp; magenta
h2 = 2 + (b - r) / delta;  // between cyan &amp; yellow
h3 = 4 + (r - g) / delta;  // between magenta &amp; cyan

h  = (r==max) * h1
h += (1 - (r==max)) * (g==max) * h2
h += (1 - (r==max)) * (1 - (g==max)) * h3

where (X==Y) means 1 if X and Y are equal, 0 if they're different (ie. what the &quot;Compare&quot; operation on a Math node does).
This is just a bunch of arithmetic operations, so it's straightforward, albeit laborious, to translate into nodes.
edit
Here's how I did it with nodes. This does
tmp = (g==max) ? h2 : h3;
h   = (r==max) ? h1 : tmp;


The If Then Else node can be done with a lerp