![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
![]() |
PRODUCT()
Calculate the product of all the elements of an array
This routine serves as an equivalent to the intrinsic PRODUCT() function
introduced in V5.6, except that the CUMULATIVE keyword is not available.
PRODUCT() is the multiplicative equivalent of TOTAL().
Result = PRODUCT(ARRAY, [/NaN] )
ARRAY = Array of elements to multiply together. For instance, ARRAY
could contain the dimensions of another array--then
PRODUCT(ARRAY) would be the total number of elements of that
other array.
The result of the function is the total product of all the elements of
ARRAY. If the input is double precision or 64bit integer, then the
result will be the same; otherwise the result will be floating point.
/NAN - If set, then PRODUCT() will check for the presence of IEEE
floating point NaN values in the input array.
ARRAY must be a numerical type.
Vector multiplication in groups of powers of two make this operation
faster than a simple FOR loop. The number of actual multiplications is
still N_ELEMENTS(ARRAY). Double precision should be used for the highest
accuracy when multiplying many numbers.
William Thompson, Feb. 1992.
Converted to IDL V5.0 W. Landsman September 1997
Use vector algorithm from C. Markwardt's CMPRODUCT W. Landsman Nov. 2001
Added /NAN keyword, documentation about V5.6 emulation W.L Nov. 2002
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]