| 1 | #include "sofa.h"
|
|---|
| 2 |
|
|---|
| 3 | void iauA2tf(int ndp, double angle, char *sign, int ihmsf[4])
|
|---|
| 4 | /*
|
|---|
| 5 | ** - - - - - - - -
|
|---|
| 6 | ** i a u A 2 t f
|
|---|
| 7 | ** - - - - - - - -
|
|---|
| 8 | **
|
|---|
| 9 | ** Decompose radians into hours, minutes, seconds, fraction.
|
|---|
| 10 | **
|
|---|
| 11 | ** This function is part of the International Astronomical Union's
|
|---|
| 12 | ** SOFA (Standards Of Fundamental Astronomy) software collection.
|
|---|
| 13 | **
|
|---|
| 14 | ** Status: vector/matrix support function.
|
|---|
| 15 | **
|
|---|
| 16 | ** Given:
|
|---|
| 17 | ** ndp int resolution (Note 1)
|
|---|
| 18 | ** angle double angle in radians
|
|---|
| 19 | **
|
|---|
| 20 | ** Returned:
|
|---|
| 21 | ** sign char '+' or '-'
|
|---|
| 22 | ** ihmsf int[4] hours, minutes, seconds, fraction
|
|---|
| 23 | **
|
|---|
| 24 | ** Called:
|
|---|
| 25 | ** iauD2tf decompose days to hms
|
|---|
| 26 | **
|
|---|
| 27 | ** Notes:
|
|---|
| 28 | **
|
|---|
| 29 | ** 1) The argument ndp is interpreted as follows:
|
|---|
| 30 | **
|
|---|
| 31 | ** ndp resolution
|
|---|
| 32 | ** : ...0000 00 00
|
|---|
| 33 | ** -7 1000 00 00
|
|---|
| 34 | ** -6 100 00 00
|
|---|
| 35 | ** -5 10 00 00
|
|---|
| 36 | ** -4 1 00 00
|
|---|
| 37 | ** -3 0 10 00
|
|---|
| 38 | ** -2 0 01 00
|
|---|
| 39 | ** -1 0 00 10
|
|---|
| 40 | ** 0 0 00 01
|
|---|
| 41 | ** 1 0 00 00.1
|
|---|
| 42 | ** 2 0 00 00.01
|
|---|
| 43 | ** 3 0 00 00.001
|
|---|
| 44 | ** : 0 00 00.000...
|
|---|
| 45 | **
|
|---|
| 46 | ** 2) The largest positive useful value for ndp is determined by the
|
|---|
| 47 | ** size of angle, the format of doubles on the target platform, and
|
|---|
| 48 | ** the risk of overflowing ihmsf[3]. On a typical platform, for
|
|---|
| 49 | ** angle up to 2pi, the available floating-point precision might
|
|---|
| 50 | ** correspond to ndp=12. However, the practical limit is typically
|
|---|
| 51 | ** ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
|
|---|
| 52 | ** only 16 bits.
|
|---|
| 53 | **
|
|---|
| 54 | ** 3) The absolute value of angle may exceed 2pi. In cases where it
|
|---|
| 55 | ** does not, it is up to the caller to test for and handle the
|
|---|
| 56 | ** case where angle is very nearly 2pi and rounds up to 24 hours,
|
|---|
| 57 | ** by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
|
|---|
| 58 | **
|
|---|
| 59 | ** This revision: 2013 July 31
|
|---|
| 60 | **
|
|---|
| 61 | ** SOFA release 2015-02-09
|
|---|
| 62 | **
|
|---|
| 63 | ** Copyright (C) 2015 IAU SOFA Board. See notes at end.
|
|---|
| 64 | */
|
|---|
| 65 | {
|
|---|
| 66 | /* Scale then use days to h,m,s function. */
|
|---|
| 67 | iauD2tf(ndp, angle/D2PI, sign, ihmsf);
|
|---|
| 68 |
|
|---|
| 69 | return;
|
|---|
| 70 |
|
|---|
| 71 | /*----------------------------------------------------------------------
|
|---|
| 72 | **
|
|---|
| 73 | ** Copyright (C) 2015
|
|---|
| 74 | ** Standards Of Fundamental Astronomy Board
|
|---|
| 75 | ** of the International Astronomical Union.
|
|---|
| 76 | **
|
|---|
| 77 | ** =====================
|
|---|
| 78 | ** SOFA Software License
|
|---|
| 79 | ** =====================
|
|---|
| 80 | **
|
|---|
| 81 | ** NOTICE TO USER:
|
|---|
| 82 | **
|
|---|
| 83 | ** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
|
|---|
| 84 | ** CONDITIONS WHICH APPLY TO ITS USE.
|
|---|
| 85 | **
|
|---|
| 86 | ** 1. The Software is owned by the IAU SOFA Board ("SOFA").
|
|---|
| 87 | **
|
|---|
| 88 | ** 2. Permission is granted to anyone to use the SOFA software for any
|
|---|
| 89 | ** purpose, including commercial applications, free of charge and
|
|---|
| 90 | ** without payment of royalties, subject to the conditions and
|
|---|
| 91 | ** restrictions listed below.
|
|---|
| 92 | **
|
|---|
| 93 | ** 3. You (the user) may copy and distribute SOFA source code to others,
|
|---|
| 94 | ** and use and adapt its code and algorithms in your own software,
|
|---|
| 95 | ** on a world-wide, royalty-free basis. That portion of your
|
|---|
| 96 | ** distribution that does not consist of intact and unchanged copies
|
|---|
| 97 | ** of SOFA source code files is a "derived work" that must comply
|
|---|
| 98 | ** with the following requirements:
|
|---|
| 99 | **
|
|---|
| 100 | ** a) Your work shall be marked or carry a statement that it
|
|---|
| 101 | ** (i) uses routines and computations derived by you from
|
|---|
| 102 | ** software provided by SOFA under license to you; and
|
|---|
| 103 | ** (ii) does not itself constitute software provided by and/or
|
|---|
| 104 | ** endorsed by SOFA.
|
|---|
| 105 | **
|
|---|
| 106 | ** b) The source code of your derived work must contain descriptions
|
|---|
| 107 | ** of how the derived work is based upon, contains and/or differs
|
|---|
| 108 | ** from the original SOFA software.
|
|---|
| 109 | **
|
|---|
| 110 | ** c) The names of all routines in your derived work shall not
|
|---|
| 111 | ** include the prefix "iau" or "sofa" or trivial modifications
|
|---|
| 112 | ** thereof such as changes of case.
|
|---|
| 113 | **
|
|---|
| 114 | ** d) The origin of the SOFA components of your derived work must
|
|---|
| 115 | ** not be misrepresented; you must not claim that you wrote the
|
|---|
| 116 | ** original software, nor file a patent application for SOFA
|
|---|
| 117 | ** software or algorithms embedded in the SOFA software.
|
|---|
| 118 | **
|
|---|
| 119 | ** e) These requirements must be reproduced intact in any source
|
|---|
| 120 | ** distribution and shall apply to anyone to whom you have
|
|---|
| 121 | ** granted a further right to modify the source code of your
|
|---|
| 122 | ** derived work.
|
|---|
| 123 | **
|
|---|
| 124 | ** Note that, as originally distributed, the SOFA software is
|
|---|
| 125 | ** intended to be a definitive implementation of the IAU standards,
|
|---|
| 126 | ** and consequently third-party modifications are discouraged. All
|
|---|
| 127 | ** variations, no matter how minor, must be explicitly marked as
|
|---|
| 128 | ** such, as explained above.
|
|---|
| 129 | **
|
|---|
| 130 | ** 4. You shall not cause the SOFA software to be brought into
|
|---|
| 131 | ** disrepute, either by misuse, or use for inappropriate tasks, or
|
|---|
| 132 | ** by inappropriate modification.
|
|---|
| 133 | **
|
|---|
| 134 | ** 5. The SOFA software is provided "as is" and SOFA makes no warranty
|
|---|
| 135 | ** as to its use or performance. SOFA does not and cannot warrant
|
|---|
| 136 | ** the performance or results which the user may obtain by using the
|
|---|
| 137 | ** SOFA software. SOFA makes no warranties, express or implied, as
|
|---|
| 138 | ** to non-infringement of third party rights, merchantability, or
|
|---|
| 139 | ** fitness for any particular purpose. In no event will SOFA be
|
|---|
| 140 | ** liable to the user for any consequential, incidental, or special
|
|---|
| 141 | ** damages, including any lost profits or lost savings, even if a
|
|---|
| 142 | ** SOFA representative has been advised of such damages, or for any
|
|---|
| 143 | ** claim by any third party.
|
|---|
| 144 | **
|
|---|
| 145 | ** 6. The provision of any version of the SOFA software under the terms
|
|---|
| 146 | ** and conditions specified herein does not imply that future
|
|---|
| 147 | ** versions will also be made available under the same terms and
|
|---|
| 148 | ** conditions.
|
|---|
| 149 | *
|
|---|
| 150 | ** In any published work or commercial product which uses the SOFA
|
|---|
| 151 | ** software directly, acknowledgement (see www.iausofa.org) is
|
|---|
| 152 | ** appreciated.
|
|---|
| 153 | **
|
|---|
| 154 | ** Correspondence concerning SOFA software should be addressed as
|
|---|
| 155 | ** follows:
|
|---|
| 156 | **
|
|---|
| 157 | ** By email: sofa@ukho.gov.uk
|
|---|
| 158 | ** By post: IAU SOFA Center
|
|---|
| 159 | ** HM Nautical Almanac Office
|
|---|
| 160 | ** UK Hydrographic Office
|
|---|
| 161 | ** Admiralty Way, Taunton
|
|---|
| 162 | ** Somerset, TA1 2DN
|
|---|
| 163 | ** United Kingdom
|
|---|
| 164 | **
|
|---|
| 165 | **--------------------------------------------------------------------*/
|
|---|
| 166 | }
|
|---|