I'm experimenting with the generated assembly and found an interesting thing.
There are two function doing an identical computation. The only difference between them is the way how the results are summed together.

#include <cmath>

double func1(double x, double y)
{
double result1;
double result2;

if (x*x < 0.0) result1 = 0.0;
else
{
result1 = x*x+x+y;
}

if (y*y < 0.0) result2 = 0.0;
else
{
result2 = y*y+y+x;
}

return (result1 + result2) * 40.0;
}

double func2(double x, double y)
{
double result = 0.0;

if (x*x >= 0.0)
{
result += x*x+x+y;
}

if (y*y >= 0.0)
{
result += y*y+y+x;
}

return result * 40.0;
}

The assembly generated by x86 clang 3.7 with

-O2

switch on gcc.godbolt.org is yet so much different and unexpected. (compilation on gcc results in similar assembly)

The reason for this behaviour of the comparison operators < or >= differs whether your double is NaN or not a NaN. All comparisons where one of the operands is NaN return false. So your x*x < 0.0 will always be false regardless of whether x is NaN or not. So the compiler can safely optimize this away. However, the case of x * x >= 0 will behave differently for NaN and non-NaN values, thus the compiler leaves the conditional jumps in the assembly.