File Coverage

palsrc/palDrange.c
Criterion Covered Total %
statement 5 7 71.4
branch 2 4 50.0
condition n/a
subroutine n/a
pod n/a
total 7 11 63.6


line stmt bran cond sub pod time code
1             /*
2             *+
3             * Name:
4             * palDrange
5              
6             * Purpose:
7             * Normalize angle into range +/- pi
8              
9             * Language:
10             * Starlink ANSI C
11              
12             * Type of Module:
13             * Library routine
14              
15             * Invocation:
16             * palDrange( double angle )
17              
18             * Arguments:
19             * angle = double (Given)
20             * The angle in radians.
21              
22             * Description:
23             * The result is "angle" expressed in the range +/- pi. If the
24             * supplied value for "angle" is equal to +/- pi, it is returned
25             * unchanged.
26              
27             * Authors:
28             * DSB: David S Berry (JAC, Hawaii)
29             * PTW: Patrick T. Wallace
30             * {enter_new_authors_here}
31              
32             * History:
33             * 2012-05-09 (DSB):
34             * Initial version with documentation taken from Fortran SLA
35             * Adapted with permission from the Fortran SLALIB library.
36             * {enter_further_changes_here}
37              
38             * Copyright:
39             * Copyright (C) 1995 Rutherford Appleton Laboratory
40             * Copyright (C) 2012 Science and Technology Facilities Council.
41             * All Rights Reserved.
42              
43             * Licence:
44             * This program is free software: you can redistribute it and/or
45             * modify it under the terms of the GNU Lesser General Public
46             * License as published by the Free Software Foundation, either
47             * version 3 of the License, or (at your option) any later
48             * version.
49             *
50             * This program is distributed in the hope that it will be useful,
51             * but WITHOUT ANY WARRANTY; without even the implied warranty of
52             * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53             * GNU Lesser General Public License for more details.
54             *
55             * You should have received a copy of the GNU Lesser General
56             * License along with this program. If not, see
57             * .
58              
59             * Bugs:
60             * {note_any_bugs_here}
61             *-
62             */
63              
64             #include "pal.h"
65             #include "palmac.h"
66             #include
67              
68 27           double palDrange( double angle ){
69 27           double result = fmod( angle, PAL__D2PI );
70 27 50         if( result > PAL__DPI ) {
71 0           result -= PAL__D2PI;
72 27 50         } else if( result < -PAL__DPI ) {
73 0           result += PAL__D2PI;
74             }
75 27           return result;
76             }
77