source: difang.f@ e40e335

Last change on this file since e40e335 was e40e335, checked in by baerbaer <baerbaer@…>, 16 years ago

Initial import to BerliOS corresponding to 3.0.4

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@1 26dc1dd8-5c4e-0410-9ffe-d298b4865968

  • Property mode set to 100644
File size: 1.5 KB
Line 
1c **************************************************************
2c
3c This file contains the subroutines: difang,addang
4c
5c Copyright 2003 Frank Eisenmenger, U.H.E. Hansmann,
6c Shura Hayryan, Chin-Ku
7c Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
8c Jan H. Meinke, Sandipan Mohanty
9c
10c **************************************************************
11
12 real*8 function difang(a1,a2)
13
14c ......................................................
15c PURPOSE: difang = a2 - a1 with: -pi < difang <= pi
16c
17c INPUT: a1,a2-two angles [rad.]
18c
19c CALLS: none
20c
21c ......................................................
22
23 implicit real*8 (a-h,o-z)
24
25 parameter (pi=3.141592653589793d0,
26 # pi2=2.d0*pi)
27
28 d=mod((a2-a1),pi2)
29 if (abs(d).le.pi) then
30 difang=d
31 else
32 difang=d-sign(pi2,d)
33 endif
34
35 return
36 end
37c *********************************
38 real*8 function addang(a1,a2)
39
40c ......................................................
41c PURPOSE: addang = a1 + a2 with: -pi < addang <= pi
42c
43c INPUT: a1,a2-two angles [rad.]
44c
45c CALLS: none
46c
47c ......................................................
48
49 implicit real*8 (a-h,o-z)
50
51 parameter (pi=3.141592653589793d0,
52 # pi2=2.d0*pi)
53
54 d=mod((a1+a2),pi2)
55 if (abs(d).le.pi) then
56 addang=d
57 else
58 addang=d-sign(pi2,d)
59 endif
60
61 return
62 end
63
Note: See TracBrowser for help on using the repository browser.