Skip to content

Commit

Permalink
pal: Modify palDrange to return +pi if supplied angle is +pi
Browse files Browse the repository at this point in the history
  • Loading branch information
David Berry committed May 9, 2012
1 parent 226d7bc commit 83382f1
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 25 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ palDmat.c \
palDs2tp.c \
palDat.c \
palDmoon.c \
palDrange.c \
palDt.c \
palDtp2s.c \
palDtps2c.c \
Expand Down
2 changes: 1 addition & 1 deletion component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- component.xml. Generated from component.xml.in by configure. -->

<component id="pal" support="S">
<version>0.1.0</version>
<version>0.1.1</version>
<path>libraries/pal</path>
<description>Position Astronomy Library</description>
<abstract><p>
Expand Down
8 changes: 4 additions & 4 deletions configure.ac
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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion pal.news
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ The Starlink Positional Astronomy Library (PAL) is a C implementation of the
SLALIB API. It is distributed under the GPL and uses the SOFA library wherever
possible.

V0.1.1

The palDrange function has been modified so that it now returns +PI if
the supplied angle is +PI (previously, it returned -PI in these cases).


V0.1.0

Initial release with sufficient SLALIB API for AST and the Astro::Coords perl module.
Initial release with sufficient SLALIB API for AST and the Astro::Coords perl module.
74 changes: 74 additions & 0 deletions palDrange.c
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;
}

8 changes: 3 additions & 5 deletions palOne2One.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* - palDpav
* - palDr2af
* - palDr2tf
* - palDrange
* - palDranrm
* - palDsep
* - palDsepv
Expand All @@ -57,6 +56,7 @@
* Authors:
* TIMJ: Tim Jenness (JAC, Hawaii)
* DSB: David S Berry (JAC, Hawaii)
* {enter_new_authors_here}
* Notes:
Expand All @@ -74,6 +74,8 @@
* Initial version
* 2012-03-23 (TIMJ):
* Update prologue.
* 2012-05-09 (DSBJ):
* Move palDrange into a separate file.
* {enter_further_changes_here}
* Copyright:
Expand Down Expand Up @@ -169,10 +171,6 @@ void palDr2tf( int ndp, double angle, char *sign, int ihmsf[4] ) {
iauA2tf( ndp, angle, sign, ihmsf );
}

double palDrange ( double angle ) {
return iauAnpm( angle );
}

double palDranrm ( double angle ) {
return iauAnp( angle );
}
Expand Down
47 changes: 33 additions & 14 deletions sun267.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
\newcommand{\stardoccategory} {Starlink User Note}
\newcommand{\stardocinitials} {SUN}
\newcommand{\stardocsource} {sun\stardocnumber}
\newcommand{\stardoccopyright}
\newcommand{\stardoccopyright}
{Copyright \copyright\ 2012 Science and Technology Facilities Council}

% Variable part - replace [xxx] as appropriate.
Expand Down Expand Up @@ -86,7 +86,7 @@
% Knoxville, TN 37996
% USA

% Do not remove the %begin{latexonly} and %end{latexonly} lines (used by
% Do not remove the %begin{latexonly} and %end{latexonly} lines (used by
% LaTeX2HTML to signify text it shouldn't process).
%begin{latexonly}
\makeatletter
Expand Down Expand Up @@ -191,10 +191,10 @@
% source prior to any statements that make of the sst commnds.

% Notes:
% The commands defined in the style file html.sty provided with LaTeX2html
% The commands defined in the style file html.sty provided with LaTeX2html
% are used. These should either be made available by using the appropriate
% sun.tex (with hypertext extensions) or by putting the file html.sty
% on your TEXINPUTS path (and including the name as part of the
% sun.tex (with hypertext extensions) or by putting the file html.sty
% on your TEXINPUTS path (and including the name as part of the
% documentstyle declaration).

% Authors:
Expand Down Expand Up @@ -270,8 +270,8 @@
% Frame attributes fount. Need to find a way for these to stand out.
% San serif doesn't work by default. Also without the \rm the
% san serif continues after \sstatt hyperlinks. Extra braces
% failed to prevent \sstattribute from using roman fount for its
% headings. The current lash up appears to work, but needs further
% failed to prevent \sstattribute from using roman fount for its
% headings. The current lash up appears to work, but needs further
% investigation or a TeX wizard.
\newcommand{\sstatt}[1]{\sf #1}
\begin{htmlonly}
Expand Down Expand Up @@ -338,7 +338,7 @@

% Format the parameters section (for an application).
\newcommand{\sstparameters}[1]{
\goodbreak
\goodbreak
\item[Parameters:] \mbox{} \\
\vspace{-3.5ex}
\begin{description}
Expand Down Expand Up @@ -602,12 +602,12 @@
\htmladdnormallink{\htmladdimg{source.gif} Retrieve hardcopy}
{http://www.starlink.ac.uk/cgi-bin/hcserver?\stardocsource}\\

% HTML document table of contents.
% HTML document table of contents.
% ================================
% Add table of contents header and a navigation button to return to this
% point in the document (this should always go before the abstract \section).
% Add table of contents header and a navigation button to return to this
% point in the document (this should always go before the abstract \section).
\label{stardoccontents}
\begin{rawhtml}
\begin{rawhtml}
<HR>
<H2>Contents</H2>
\end{rawhtml}
Expand Down Expand Up @@ -690,7 +690,6 @@ \subsection{SOFA Mappings}
\texttt{palDpav} & \texttt{iauPap}\\
\texttt{palDr2af} & \texttt{iauA2af}\\
\texttt{palDr2tf} & \texttt{iauA2tf}\\
\texttt{palDrange} & \texttt{iauAnpm}\\
\texttt{palDranrm} & \texttt{iauAnp}\\
\texttt{palDsep} & \texttt{iauSeps}\\
\texttt{palDsepv} & \texttt{iauSepp}\\
Expand All @@ -710,7 +709,6 @@ \subsection{SOFA Mappings}
\texttt{palHfk5z} & \texttt{iauHfk5z} \textit{also calls iauEpj2jd}\\
\end{tabular}


\subsection{More complex functions}

These functions do not have a simple equivalent in SOFA so are
Expand Down Expand Up @@ -1666,6 +1664,27 @@ \subsection{More complex functions}
}
}
}
\sstroutine{
palDrange
}{
Normalize angle into range $+$/- pi
}{
\sstdescription{
The result is {\tt "}angle{\tt "} expressed in the range $+$/- pi. If the
supplied value for {\tt "}angle{\tt "} is equal to $+$/- pi, it is returned
unchanged.
}
\sstinvocation{
palDrange( double angle )
}
\sstarguments{
\sstsubsection{
angle = double (Given)
}{
The angle in radians.
}
}
}
\sstroutine{
palDt
}{
Expand Down

0 comments on commit 83382f1

Please sign in to comment.