


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Let Z = Y / X. If Z > 0, then either X > 0 and Y > 0 or X < 0 and Y < 0. If Z < 0, then either X > 0 and Y < 0 or X < 0 and Y > 0. Note: If X = 0, Y / X is not defined. NOTE: Too many students got hung up on this one. One does not throw and exception when X = 0, but handles it separately, as follows: If (X = 0) Then If Y > 0 Return 90 Else if Y < 0 Return 270 Else // Here Y = 0 and X = 0, so it is appropriate to throw an exception. End If Else // X is not 0 Z = Y / X = ATAN(Z) // Process this based on the sign of X. End If Suppose X 0. This table tells us what to do. X > 0 X < 0 Z > 0 Y > 0
If X = 0 and Y = 0, there is no answer. Comment: In grading I looked for some sort of distinct handling for the three cases based on the sign of X.