![]() Of course we could avoid all these questions by adding an if within the function definition so that the function returns $0$ when $x=y=0$ regardless of the implementation of atan2 (that is, it never calls atan2 in that case). ![]() If all those things are true then you have found a defect in their software. It is also possible that the authors eventually use their SphericalPhi function on an implementation in which atan2(0,0) produces a domain error, in an application that can call this function when $x=y=0,$ in a place where NaN is not an acceptable value for SphericalPhi to return (or the domain error raises an uncaught exception). Gives a useful result only when $\sin\theta\neq 0.$ Used an implementation of std::atan2 that does not produce a domain error when $x=y=0,$ and that they assumed the reader would use such an implementation too.īut it is also possible that the application described on that pageĪfter all, the formula $\mathrm d\omega = \sin\theta\, \mathrm d\theta\,\mathrm d\phi$ It is possible that the authors of the page you were concerned about That seems to be as good a result as any when you are setting the angle $\phi$ for Cartesian coordinates of the form $(0,0,z).$ This may be implementation-dependent, but in at least some implementations of the standard C++ math library,ĭouble t = std::atan2(0,0) simply sets t to zero. Why is this correct even when $\sin\theta=0$? Am I missing something or are they wrong? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |