Go south, east and north, come to the same place There is that famous riddle:


  A bear walks 1 km south, 1 km east and 1 km north, and comes to the place it started from. What color is the bear?


This one is very old, so I'll generalize it:


  A bear walks x km south, y km east and x km north, and comes to the place it started from. This bear thinks that the North Pole is boring, so it never goes there. Which latitude did it start and end at?


Assume that the bear is an idealized point, and the Earth is a perfect sphere with 10000 km distance from the pole to the equator (however, you can use a more accurate model if it's easier for some reason).

Write a program or a subroutine that receives the two numbers x and y, and prints or returns the latitude.

Fine points:


Input with at least 3 decimal places of precision should be supported
Input is in the range (0...99999), bounds not inclusive
If the situation is physically impossible, print an empty string or a message, or return an impossible value (like 91 or NaN - or, in fact, 90 - since 90 is an impossible value)
You should print the most northern (maximal) latitude that satisfies the conditions, except the North Pole. If the North Pole is the only solution, see above.
Output precision should be like IEEE single precison or better (24 bits or 7 decimal digits of precision).
If the output is printed, use decimal notation (e.g. -89.99 for a point near the South Pole) . If the output is returned, use floating-point or fixed-point notation.


Shortest code in bytes wins.
CJam, 62 chars

{4e4/:Y\9e-3*:X90-P180/:Q*mc/XY2$m](/mCQ/+_90&lt;\@XY@m[)/mCQ/-?}


This is a block (subroutine) which takes x y on the stack and leaves the solution on the stack.

Online demo

I'm interpreting the spec to allow returning 90 as an "impossible value" if there is no other solution. If that interpretation is disallowed, I think the best fix would be

{4e4/:Y\9e-3*:X90-P180/:Q*mc/[XY2$m](/mCQ/+\XY@m[)/mCQ/--91]{90&lt;}=}