You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/math/base/tools/evalrational-compile/README.md
+85-29Lines changed: 85 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,9 @@ limitations under the License.
36
36
var compile =require( '@stdlib/math/base/tools/evalrational-compile' );
37
37
```
38
38
39
-
#### compile( P, Q )
39
+
#### compile( P, Q\[, options] )
40
40
41
-
Compiles a module `string` containing an exported function which evaluates a [rational function][@stdlib/math/base/tools/evalrational] having coefficients `P` and `Q`.
41
+
Compiles a module string containing an exported function which evaluates a [rational function][@stdlib/math/base/tools/evalrational] having coefficients `P` and `Q`.
42
42
43
43
```javascript
44
44
varP= [ 3.0, 2.0, 1.0 ];
@@ -48,7 +48,11 @@ var str = compile( P, Q );
48
48
// returns <string>
49
49
```
50
50
51
-
In the example above, the output `string` would correspond to the following module:
51
+
The function supports the following `options`:
52
+
53
+
-**dtype**: input argument floating-point data type (e.g., `float64` or `float32`). Default: `'float64'`.
54
+
55
+
In the example above, the output string would correspond to the following module:
The coefficients should be ordered in **ascending** degree, thus matching summation notation.
104
108
109
+
By default, the function assumes double-precision floating-point arithmetic. To emulate single-precision floating-point arithmetic, set the `dtype` option to `'float32'`.
110
+
111
+
```javascript
112
+
varP= [ 3.0, 2.0, 1.0 ];
113
+
varQ= [ -1.0, -2.0, -3.0 ];
114
+
115
+
var str =compile( P, Q, {
116
+
'dtype':'float32'
117
+
});
118
+
// returns <string>
119
+
```
120
+
121
+
In the previous example, the output string would correspond to the following module:
122
+
123
+
<!-- eslint-disable no-unused-expressions -->
124
+
125
+
```javascript
126
+
'use strict';
127
+
128
+
// MODULES //
129
+
130
+
var float64ToFloat32 =require( '@stdlib/number/float64/base/to-float32' );
131
+
132
+
133
+
// MAIN //
134
+
135
+
/**
136
+
* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)).
137
+
*
138
+
* ## Notes
139
+
*
140
+
* - Coefficients should be sorted in ascending degree.
141
+
* - The implementation uses [Horner's rule][horners-method] for efficient computation.
0 commit comments