Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Mar 24, 2024
1 parent 0cacf4c commit a813946
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 40 deletions.
23 changes: 4 additions & 19 deletions base/tools/evalpoly-compile-c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,29 +123,14 @@ static float polyval123( const float x ) {
<!-- eslint no-undef: "error" -->
```javascript
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var Float64Array = require( '@stdlib/array/float64' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var compile = require( '@stdlib/math/base/tools/evalpoly-compile-c' );
var coef;
var sign;
var str;
var i;
// Create an array of random coefficients...
coef = new Float64Array( 10 );
for ( i = 0; i < coef.length; i++ ) {
if ( randu() < 0.5 ) {
sign = -1.0;
} else {
sign = 1.0;
}
coef[ i ] = sign * round( randu()*100.0 );
}
// Create an array of random coefficients:
var coef = discreteUniform( 10, -100, 100 );
// Compile a function for evaluating a polynomial:
str = compile( coef );
var str = compile( coef );
console.log( str );
```

Expand Down
2 changes: 1 addition & 1 deletion base/tools/evalpoly-compile-c/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface Options {
/**
* Input value floating-point data type (e.g., `double` or `float`). Default: `'double'`.
*/
dtype?: string;
dtype?: 'double' | 'float';

/**
* Function name. Default: `'evalpoly'`.
Expand Down
2 changes: 1 addition & 1 deletion base/tools/evalpoly-compile-c/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import compile = require( './index' );
compile( [ 3.0, 2.0, 1.0 ], ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided a `dtype` option which is not a string...
// The compiler throws an error if the function is provided an invalid `dtype` option...
{
compile( [ 3.0, 2.0, 1.0 ], { 'dtype': true } ); // $ExpectError
compile( [ 3.0, 2.0, 1.0 ], { 'dtype': false } ); // $ExpectError
Expand Down
23 changes: 4 additions & 19 deletions base/tools/evalpoly-compile-c/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
'use strict';

var resolve = require( 'path' ).resolve;
var randu = require( '@stdlib/random/base/randu' );
var round = require( './../../../../base/special/round' );
var Float64Array = require( '@stdlib/array/float64' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var tryRequire = require( '@stdlib/utils/try-require' );

var compile = tryRequire( resolve( __dirname, '..', 'lib' ) );
Expand All @@ -32,23 +30,10 @@ if ( compile instanceof Error ) {
}

function main() {
var coef;
var sign;
var str;
var i;

// Create an array of random coefficients...
coef = new Float64Array( 10 );
for ( i = 0; i < coef.length; i++ ) {
if ( randu() < 0.5 ) {
sign = -1.0;
} else {
sign = 1.0;
}
coef[ i ] = sign * round( randu()*100.0 );
}
// Create an array of random coefficients:
var coef = discreteUniform( 10, -100, 100 );

// Compile a function for evaluating a polynomial:
str = compile( coef );
var str = compile( coef );
console.log( str );
}

0 comments on commit a813946

Please sign in to comment.