square root of large number
You need 2 typecasts. So 

atan(-ax/sqrt((float)ay*ay+(float)az*az));


Otherwise it will use int16_t for the right side of the addition and overflow.

Though for speed you might want to typecast them as long (int32_t), as floats calculations on the arduino are really slow. The sqrt function will covert this double into a float for you.