[SciPy-User] difference of angles - to be between -180 and + 180
Thu Nov 19 07:52:13 CST 2009
Thanks for the enlightenment ;-)
On Thu, Nov 19, 2009 at 2:34 PM, Chris Colbert <firstname.lastname@example.org> wrote:
> On Thu, Nov 19, 2009 at 1:48 PM, Sebastian Haase <email@example.com> wrote:
>> On Wed, Nov 18, 2009 at 5:19 PM, Jonathan Guyer <firstname.lastname@example.org> wrote:
>>> On Nov 18, 2009, at 11:14 AM, I wrote:
>>>> return np.fmod(d + 540, 360) - 180
>>> Actually, I think you can just write (d + 540) % 360 - 180
>>> I think we used fmod because of some automatic weave inlining we do
>>> that didn't play nice with '%'.
>> Hi Jonathan,
>> thanks for your answer. I might prefer your solution simply for its brevity.
>> However, there are also some sign "problems":
>> for the angle from -10 to 180 I was expecting +170, but your solution
>> returns -170.
>> and for (to:)'190' (from) '-10' expected: '160' , yours returns -160.
> -170 and -160 are the correct answers for those differences
>> I have a list of 30 test cases, which these are the only 2 were yours
>> gave unexpected results regarding the sign -- besides the fact that
>> yours always returns -180 instead of +180, but that is obviously not
>> really wrong.
>> SciPy-User mailing list
> SciPy-User mailing list
More information about the SciPy-User