Hexapod InverseKinemetics Problem

Thanks everyone, whit the atan2 function and some debugging the code works correct now.