I'm betting that the A4 angle is exactly 180deg different, correct?
On any 6-axis articulated robot, for a given set of Cartesian coordinates, there is more than one way for the robot to reach the commanded XYZABC position. In this case, if you rotate A4 180deg, rotate A6 180deg in the opposite direction, and negate A5, you'll find that the TCP ends up at the same position and orientation in space. This ambiguity means that the robot doesn't know exactly how to achieve the position you want, which is why, if you look into an E6POS position, you'll find two variables, S and T.
Try this: put your robot in a given position in space, and record that point. Then rotate A4 180deg, and jog A6 and A5 until you get the TCP back to the same position in space. Record this point. Then compare the two points. What you should find is that they are identical (to within small fractions) except for the S and T values, which will be different.
S and T are complicated, but the short version is that they describe how the waist, wrist, and elbow of the robot should be oriented for a particular Cartesian position. The INVERSE function has to take them into account in order to generate a correct E6AXIS value from a given E6POS.
In this usage:
DestinationAxis = INVERSE(DestinationPos, StartAxisPos, ErrorCode)
StartAxisPos is an E6AXIS variable that acts as the starting position for the calculation. This variable is only evaluated if DestinationPos does not have S and/or T defined.
How this variable is evaluated is controlled by the setting of the system variable $TARGET_STATUS.
If $TARGET_STATUS is set to #SOURCE, then the INVERSE function will calculate the S and T values for StartAxisPos, and then put those S and T values into DestinationAxis.
If $TARGET_STATUS is set to #BEST, then the INVERSE function will calculate which E6AXIS result for DestinationAxis will result in the shortest path, in axis space, from StartAxisPos. In other words, which destination will result in the smallest amount of axis movement. If you ever watch a move between two points whose S and T values are mismatched, you'll see that the result is often a great degree of extra, unnecessary axis motion.
So, you need to choose a good starting point for StartAxisPos, and choose the correct setting for $TARGET_STATUS.