I am reading the book Numerical Recipes in C in the chapter about the bisection algorithm for root finding but in the code I'm confounded by the following line of code:
rtb = f < 0.0 ? (dx=x2-x1,x1) : (dx=x1-x2,x2);
I know that the operator ( code1 ) ? ( code2 ) : ( code3 )
is like a if( code1 ) ( code2 ) else ( code3 )
but what i don't understand is that rtb
that is a float is receiving either (dx=x2-x1,x1)
or (dx=x1-x2,x2)
, being x1
and x2
floats would't this be assigning some type of ordered pair of floats to a single float ?