source: trunk/MagicSoft/slalib/daf2r.c@ 998

Last change on this file since 998 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaDaf2r ( int ideg, int iamin, double asec, double *rad, int *j )
4/*
5** - - - - - - - - -
6** s l a D a f 2 r
7** - - - - - - - - -
8**
9** Convert degrees, arcminutes, arcseconds to radians.
10**
11** (double precision)
12**
13** Given:
14** ideg int degrees
15** iamin int arcminutes
16** asec double arcseconds
17**
18** Returned:
19** *rad double angle in radians
20** *j int status: 0 = OK
21** 1 = ideg outside range 0-359
22** 2 = iamin outside range 0-59
23** 3 = asec outside range 0-59.999...
24**
25** Notes:
26** 1) The result is computed even if any of the range checks fail.
27**
28** 2) The sign must be dealt with outside this routine.
29**
30** Defined in slamac.h: DAS2R
31**
32** Last revision: 31 October 1993
33**
34** Copyright P.T.Wallace. All rights reserved.
35*/
36{
37/* Preset status */
38 *j = 0;
39
40/* Validate arcsec, arcmin, deg */
41 if ( ( asec < 0.0 ) || ( asec >= 60.0 ) ) {
42 *j = 3;
43 return;
44 }
45 if ( ( iamin < 0 ) || ( iamin > 59 ) ) {
46 *j = 2;
47 return;
48 }
49 if ( ( ideg < 0 ) || ( ideg > 359 ) ) {
50 *j = 1;
51 return;
52 }
53
54/* Compute angle */
55 *rad = DAS2R * ( 60.0 * ( 60.0 * (double) ideg
56 + (double) iamin )
57 + asec );
58}
Note: See TracBrowser for help on using the repository browser.