Source

Branch

1/ @and_coder

@iquilezles

I’d say ALWAYS look at the generated assembly when you care about optimizations. I’ve seen NVidia compilers still generated branches even with the ternary operator if arguments are expressions. To be sure have float a = …, float b = …, and then float c = (x < 0.5) ? a : b;