File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
lib/node_modules/@stdlib/stats/incr/mprod Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,56 @@ p = accumulator();
6969// returns 105.0
7070```
7171
72+ Under certain conditions, overflow may be transient.
73+
74+ ``` javascript
75+ // Large values:
76+ var x = 5.0e+300 ;
77+ var y = 1.0e+300 ;
78+
79+ // Tiny value:
80+ var z = 2.0e-302 ;
81+
82+ // Initialize an accumulator:
83+ var accumulator = incrmprod ( 3 );
84+
85+ var p = accumulator ( x );
86+ // returns 5.0e+300
87+
88+ // Transient overflow:
89+ p = accumulator ( y );
90+ // returns Infinity
91+
92+ // Recover a finite result:
93+ p = accumulator ( z );
94+ // returns 1.0e+299
95+ ```
96+
97+ Similarly, under certain conditions, underflow may be transient.
98+
99+ ``` javascript
100+ // Tiny values:
101+ var x = 4.0e-302 ;
102+ var y = 9.0e-303 ;
103+
104+ // Large value:
105+ var z = 2.0e+300 ;
106+
107+ // Initialize an accumulator:
108+ var accumulator = incrmprod ( 3 );
109+
110+ var p = accumulator ( x );
111+ // returns 4.0e-302
112+
113+ // Transient underflow:
114+ p = accumulator ( y );
115+ // returns 0.0
116+
117+ // Recover a non-zero result:
118+ p = accumulator ( z );
119+ // returns 7.2e-304
120+ ```
121+
72122</section >
73123
74124<!-- /.usage -->
You can’t perform that action at this time.
0 commit comments