source: trunk/MagicSoft/slalib/epco.c@ 18679

Last change on this file since 18679 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"
3#include <ctype.h>
4double slaEpco ( char k0, char k, double e )
5/*
6** - - - - - - - -
7** s l a E p c o
8** - - - - - - - -
9**
10** Convert an epoch into the appropriate form - 'B' or 'J'.
11**
12** Given:
13** k0 char form of result: 'B'=Besselian, 'J'=Julian
14** k char form of given epoch: 'B' or 'J'
15** e double epoch
16**
17** Called: slaEpb, slaEpj2d, slaEpj, slaEpb2d
18**
19** Notes:
20**
21** 1) The result is always either equal to or very close to
22** the given epoch e. The routine is required only in
23** applications where punctilious treatment of heterogeneous
24** mixtures of star positions is necessary.
25**
26** 2) k0 and k are not validated, and only their first characters
27** are used, interpreted as follows:
28**
29** o If k0 and k are the same the result is e.
30** o If k0 is 'B' or 'b' and k isn't, the conversion is J to B.
31** o In all other cases, the conversion is B to J.
32**
33** Last revision: 18 November 1993
34**
35** Copyright P.T.Wallace. All rights reserved.
36*/
37{
38 double result;
39 int c;
40
41 c = toupper ( (int) k0 );
42 if ( c == toupper ( (int) k ) ) {
43 result = e;
44 } else {
45 if ( c == (int) 'B' ) {
46 result = slaEpb ( slaEpj2d ( e ) );
47 } else {
48 result = slaEpj ( slaEpb2d ( e ) );
49 }
50 }
51 return ( result );
52}
Note: See TracBrowser for help on using the repository browser.