1 /* zzck4i2d.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* $Procedure      ZZCK4I2D ( Pack set of integers into a single DP ) */
zzck4i2d_(integer * i__,integer * nsets,doublereal * parcod,doublereal * dpcoef)9 /* Subroutine */ int zzck4i2d_(integer *i__, integer *nsets, doublereal *
10 	parcod, doublereal *dpcoef)
11 {
12     /* System generated locals */
13     integer i__1;
14 
15     /* Local variables */
16     integer k;
17     doublereal x;
18 
19 /* $ Abstract */
20 
21 /*     SPICE Private routine intended solely for the support of SPICE */
22 /*     routines. Users should not call this routine directly due */
23 /*     to the volatile nature of this routine. */
24 
25 /*     This is the routine that packs a set integer numbers into a */
26 /*     single double precision number. */
27 
28 /*     Its current specific use is to "compress" seven integer numbers */
29 /*     representing numbers of polynomial coefficients in a logical */
30 /*     type 4 CK record into a single DP number stored in a physical */
31 /*     type 4 CK record in a file. */
32 
33 /* $ Disclaimer */
34 
35 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
36 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
37 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
38 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
39 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
40 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
41 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
42 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
43 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
44 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
45 
46 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
47 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
48 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
49 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
50 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
51 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
52 
53 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
54 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
55 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
56 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
57 
58 /* $ Required_Reading */
59 
60 /*     None. */
61 
62 /* $ Keywords */
63 
64 /*     None. */
65 
66 /* $ Declarations */
67 /* $ Brief_I/O */
68 
69 /*     Variable  I/O  Description */
70 /*     --------  ---  -------------------------------------------------- */
71 /*     I          I   Array of NSETS integer components. */
72 /*     NSETS      I   Number of integer components in input array I. */
73 /*     PARCOD     I   Packing base. */
74 /*     DPCOEF     O   DP number containing NSETS packed integer numbers. */
75 
76 /* $ Detailed_Input */
77 
78 /*     I          is an array containing integers to be packed. */
79 
80 /*     NSETS      is the number of elements in the array I. */
81 
82 /*     PARCOD     is the packing base. */
83 
84 /* $ Detailed_Output */
85 
86 /*     DPCOEF     is a DP number containing elements of the input */
87 /*                array packed together. */
88 
89 /* $ Parameters */
90 
91 /*     None. */
92 
93 /* $ Files */
94 
95 /*     None. */
96 
97 /* $ Exceptions */
98 
99 /*     Error free. */
100 
101 /*     No checking is done to determine whether elements of the array */
102 /*     I are within range [0:PARCOD-1] and whether PARCOD**NSETS will */
103 /*     cause DPCOEF mantissa overflow. */
104 
105 /* $ Particulars */
106 
107 /*     This routine packs NSETS elements of the array I into a single */
108 /*     double precision variable using base specified by PARCOD. When */
109 /*     packed the double precision number DPCOEF represents NSETS of */
110 /*     integer elements of the array I as follows: */
111 
112 /*        [DPCOEF]= PARCOD ** ( NSETS - 1 ) * I( 1 )        + */
113 /*                  PARCOD ** ( NSETS - 2 ) * I( 2 )        + */
114 /*                  ... */
115 /*                  PARCOD ** 1             * I( NSETS - 1 )+ */
116 /*                  PARCOD ** 0             * I( NSETS ) */
117 /*     where: */
118 
119 /*        I(1:NSETS) - is an array of integer numbers with values */
120 /*                     in the range [0:PARCOD-1]. */
121 
122 /* $ Examples */
123 
124 /*     None. */
125 
126 /* $ Restrictions */
127 
128 /*     1) No checking is done to determine whether elements of the */
129 /*        array I are within range [0:PARCOD-1] to prevent "overflow" */
130 /*        of particular */
131 
132 /*     2) No checking is done to determine whether PARCOD**NSETS */
133 /*        will cause DPCOEF mantissa overflow. */
134 
135 /* $ Literature_References */
136 
137 /*     None. */
138 
139 /* $ Author_and_Institution */
140 
141 /*     Y.K. Zaiko     (JPL) */
142 /*     B.V. Semenov   (JPL) */
143 
144 /* $ Version */
145 
146 /* -    SPICELIB Version 1.0.0, 05-MAY-1999 (YKZ) (BVS) */
147 
148 /* -& */
149 
150 /*     Local variables */
151 
152 
153 /*     Let's pack it! */
154 
155     *dpcoef = 0.;
156     x = 1.;
157     i__1 = *nsets;
158     for (k = 1; k <= i__1; ++k) {
159 	*dpcoef += i__[k - 1] * x;
160 	x *= *parcod;
161     }
162 
163 /*     All done. */
164 
165     return 0;
166 } /* zzck4i2d_ */
167 
168