time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1192B)


      1 
      2 {{alias}}()
      3     Returns an accumulator function which incrementally computes a product.
      4 
      5     If provided a value, the accumulator function returns an updated product. If
      6     not provided a value, the accumulator function returns the current product.
      7 
      8     If provided `NaN` or a value which, when used in computations, results in
      9     `NaN`, the accumulated value is `NaN` for all future invocations.
     10 
     11     For long running accumulations or accumulations of large numbers, care
     12     should be taken to prevent overflow. Note, however, that overflow/underflow
     13     may be transient, as the accumulator does not use a double-precision
     14     floating-point number to store an accumulated product. Instead, the
     15     accumulator splits an accumulated product into a normalized fraction and
     16     exponent and updates each component separately. Doing so guards against a
     17     loss in precision.
     18 
     19     Returns
     20     -------
     21     acc: Function
     22         Accumulator function.
     23 
     24     Examples
     25     --------
     26     > var accumulator = {{alias}}();
     27     > var v = accumulator()
     28     null
     29     > v = accumulator( 2.0 )
     30     2.0
     31     > v = accumulator( -5.0 )
     32     -10.0
     33     > v = accumulator()
     34     -10.0
     35 
     36     See Also
     37     --------
     38