[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: modulo 2 pi?
From: |
Søren Hauberg |
Subject: |
Re: modulo 2 pi? |
Date: |
Wed, 21 Jan 2009 14:48:32 +0100 |
ons, 21 01 2009 kl. 14:23 +0100, skrev Francesco Potortì:
> >If I have two angles 'theta' and 'psi', and I want to compute their
> >difference I can simply do
> >
> > d = theta - psi;
> >
> >However, I'd like this result to be in the range [0, 2*pi]. Can I simply
> >do
> >
> > d = mod (theta - psi, 2*pi);
> >
> >or will this fail in some cases?
>
> It should not. It would fail if you used 'rem', but using 'mod' you
> should have no problems.
Thanks. I've been using 'mod' for some time now, but I wanted to double
check.
Thanks again,
Søren