product

Table of Contents

Prototype: product(list)

Return type: real

Description: Returns the product of the reals in list.

This function might be used for simple ring computation. Of course, you could easily combine product with readstringarray or readreallist etc., to collect summary information from a source external to CFEngine.

This function can accept many types of data parameters.

Arguments:

  • list: string, in the range: .*

Example:

body common control
{
      bundlesequence => { "test" };
}

bundle agent test
{
  vars:

      "series" rlist => { "1.1", "2.2", "3.3", "5.5", "7.7" };

      "prod" real => product("series");
      "sum"  real => sum("series");

  reports:
      "Product result: $(prod) > $(sum)";
}

Output:

R: Product result: 338.207100 > 19.800000

History: Was introduced in version 3.1.0b1,Nova 2.0.0b1 (2010). The collecting function behavior was added in 3.9.

See also: sort(), variance(), sum(), max(), min(), about collecting functions, and data documentation.