SpiceDouble sumad_c ( ConstSpiceDouble * array,
SpiceInt n )
Return the sum of the elements of a double precision array.
None.
ARRAY, MATH, UTILITY
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
array I Input array.
n I Number of elements in the array.
The function returns the sum of the elements of the input array.
array is the input array.
n is the number of elements in the array.
The function returns the sum of the elements of the input array.
That is,
sumad_c ( array, n ) = array[0] + array[1] + ... + array[n-1]
If n is zero or negative, sumad_c returns zero.
None.
Error free.
None.
The value of the function is initially set to zero. The elements
of the array are then added. If the number of elements is
zero or negative, sumad_c is zero.
Let array contain the following elements.
array[0] = 12.
array[1] = 1.
array[2] = 4.
array[3] = 75.
array[4] = 18.
Then
sumad_c ( array, -3 ) = 0.
sumad_c ( array, 0 ) = 0.
sumad_c ( array, 1 ) = 12.
sumad_c ( array, 2 ) = 13.
sumad_c ( array, 5 ) = 110.
sumad_c ( array+2, 3 ) = 97.
sumad_c does not check for overflow.
None.
N.J. Bachman (JPL)
I.M. Underwood (JPL)
-CSPICE Version 1.0.0, 24-MAR-1999 (IMU) (NJB)
sum of a d.p. array
Link to routine sumad_c source file sumad_c.c
|