 NCL Home > Documentation > Functions > General applied math

# product

Computes the product of the input.

## Prototype

```	function product (
x  : snumeric   ; numeric for NCL V6.4.0 and earlier
)

return_val  :  typeof(x)
```

## Arguments

x

A numeric array of any dimensionality.

## Return value

A scalar value of the same type as x

## Description

Returns the product of the input values, regardless of dimensionality. It ignores missing values.

This function was enhanced in NCL V6.5.0 to allow snumeric input types like int64, uint64, ulong, etc.

## Examples

Example 1

Calculate the number of elements (ne) in an array. Let x(120,5,73,144), then use dimsizes to get the size of each dimension:

```  ne   = product( dimsizes(x)) ; ===> 120*5*73*144 = 6307200
```
Example 2

In the example below, see how setting the missing value, x@_FillValue, changes the product calculation:

```  x    = (/ (/1,-99/), (/3,4/), (/-99,6/) /)
xproduct = product(x)
;
; Before missing value is set, xproduct = 705672.
;
print(xproduct)

x@_FillValue = -99
xproduct = product(x)
;
; After missing value is set, xproduct = 72.
;
print(xproduct)
```