-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pal: Modify palDrange to return +pi if supplied angle is +pi
- Loading branch information
David Berry
committed
May 9, 2012
1 parent
226d7bc
commit 83382f1
Showing
7 changed files
with
123 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ palDmat.c \ | |
palDs2tp.c \ | ||
palDat.c \ | ||
palDmoon.c \ | ||
palDrange.c \ | ||
palDt.c \ | ||
palDtp2s.c \ | ||
palDtps2c.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
dnl Process this file with autoconf to produce a configure script | ||
AC_REVISION($Revision: 27534 $) | ||
|
||
dnl Initialisation: package name and version number | ||
AC_INIT(pal, 0.1.0, [email protected]) | ||
AC_INIT(pal, 0.1.1, [email protected]) | ||
|
||
dnl Require autoconf-2.50 at least | ||
AC_PREREQ(2.50) | ||
dnl Require Starlink automake | ||
|
@@ -31,7 +31,7 @@ STAR_DECLARE_DEPENDENCIES(link, [sofa starutil]) | |
dnl List the sun/ssn/... numbers which document this package and | ||
dnl which are present as .tex files in this directory. | ||
STAR_LATEX_DOCUMENTATION(sun267) | ||
|
||
dnl If you wish to configure extra files, you can add them to this | ||
dnl declaration. | ||
AC_CONFIG_FILES(Makefile component.xml) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
*+ | ||
* Name: | ||
* palDrange | ||
* Purpose: | ||
* Normalize angle into range +/- pi | ||
* Language: | ||
* Starlink ANSI C | ||
* Type of Module: | ||
* Library routine | ||
* Invocation: | ||
* palDrange( double angle ) | ||
* Arguments: | ||
* angle = double (Given) | ||
* The angle in radians. | ||
* Description: | ||
* The result is "angle" expressed in the range +/- pi. If the | ||
* supplied value for "angle" is equal to +/- pi, it is returned | ||
* unchanged. | ||
* Authors: | ||
* DSB: David S Berry (JAC, Hawaii) | ||
* {enter_new_authors_here} | ||
* History: | ||
* 2012-05-09 (DSB): | ||
* Initial version with documentation taken from Fortran SLA | ||
* {enter_further_changes_here} | ||
* Copyright: | ||
* Copyright (C) 2012 Science and Technology Facilities Council. | ||
* All Rights Reserved. | ||
* Licence: | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 3 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
* PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
* USA. | ||
* Bugs: | ||
* {note_any_bugs_here} | ||
*- | ||
*/ | ||
|
||
#include "pal.h" | ||
#include "palmac.h" | ||
#include <math.h> | ||
|
||
double palDrange( double angle ){ | ||
double result = fmod( angle, PAL__D2PI ); | ||
if( result > PAL__DPI ) { | ||
result -= PAL__D2PI; | ||
} else if( result < -PAL__DPI ) { | ||
result += PAL__D2PI; | ||
} | ||
return result; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters