Skip to content

Commit c2b6ebe

Browse files
author
aayush0325
committed
feat: some changes
1 parent 6c5e9ed commit c2b6ebe

File tree

3 files changed

+137
-14
lines changed

3 files changed

+137
-14
lines changed

lib/node_modules/@stdlib/math/base/special/exp2f/lib/polyval_p.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
/* This is a generated file. Do not edit directly. */
2020
'use strict';
2121

22-
// MODULES //
23-
24-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
25-
26-
2722
// MAIN //
2823

2924
/**
@@ -41,9 +36,9 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
4136
*/
4237
function evalpoly( x ) {
4338
if ( x === 0.0 ) {
44-
return 1513.9068603515625;
39+
return 1513.906801156151;
4540
}
46-
return float64ToFloat32(1513.9068603515625 + float64ToFloat32(x * float64ToFloat32(20.20206642150879 + float64ToFloat32(x * 0.023093348369002342)))); // eslint-disable-line max-len
41+
return 1513.906801156151 + (x * (20.202065669316532 + (x * 0.023093347705734523))); // eslint-disable-line max-len
4742
}
4843

4944

lib/node_modules/@stdlib/math/base/special/exp2f/lib/polyval_q.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
/* This is a generated file. Do not edit directly. */
2020
'use strict';
2121

22-
// MODULES //
23-
24-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
25-
26-
2722
// MAIN //
2823

2924
/**
@@ -41,9 +36,9 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
4136
*/
4237
function evalpoly( x ) {
4338
if ( x === 0.0 ) {
44-
return 4368.21142578125;
39+
return 4368.211668792106;
4540
}
46-
return float64ToFloat32(4368.21142578125 + float64ToFloat32(x * float64ToFloat32(233.1842041015625 + float64ToFloat32(x * 1.0)))); // eslint-disable-line max-len
41+
return 4368.211668792106 + (x * (233.1842117223149 + (x * 1.0)));
4742
}
4843

4944

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2018 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/*
20+
* This script compiles modules for evaluating polynomial functions. If any polynomial coefficients change, this script should be rerun to update the compiled files.
21+
*/
22+
'use strict';
23+
24+
// MODULES //
25+
26+
var resolve = require( 'path' ).resolve;
27+
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
28+
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
29+
var currentYear = require( '@stdlib/time/current-year' );
30+
var substringBefore = require( '@stdlib/string/substring-before' );
31+
var substringAfter = require( '@stdlib/string/substring-after' );
32+
var format = require( '@stdlib/string/format' );
33+
var licenseHeader = require( '@stdlib/_tools/licenses/header' );
34+
var compile = require( '@stdlib/math/base/tools/evalpoly-compile' );
35+
var compileC = require( '@stdlib/math/base/tools/evalpoly-compile-c' );
36+
37+
38+
// VARIABLES //
39+
40+
// Polynomial coefficients ordered in ascending degree...
41+
var P = [
42+
1.51390680115615096133e3,
43+
2.02020656693165307700e1,
44+
2.30933477057345225087e-2
45+
];
46+
var Q = [
47+
4.36821166879210612817e3,
48+
2.33184211722314911771e2,
49+
1.0
50+
];
51+
52+
// Header to add to output files:
53+
var header = licenseHeader( 'Apache-2.0', 'js', {
54+
'year': currentYear(),
55+
'copyright': 'The Stdlib Authors'
56+
});
57+
header += '\n/* This is a generated file. Do not edit directly. */\n';
58+
59+
60+
// FUNCTIONS //
61+
62+
/**
63+
* Inserts a compiled function into file content.
64+
*
65+
* @private
66+
* @param {string} text - source content
67+
* @param {string} id - function identifier
68+
* @param {string} str - function string
69+
* @returns {string} updated content
70+
*/
71+
function insert( text, id, str ) {
72+
var before;
73+
var after;
74+
var begin;
75+
var end;
76+
77+
begin = '// BEGIN: '+id;
78+
end = '// END: '+id;
79+
80+
before = substringBefore( text, begin );
81+
after = substringAfter( text, end );
82+
83+
return format( '%s// BEGIN: %s\n\n%s\n%s%s', before, id, str, end, after );
84+
}
85+
86+
87+
// MAIN //
88+
89+
/**
90+
* Main execution sequence.
91+
*
92+
* @private
93+
*/
94+
function main() {
95+
var fpath;
96+
var copts;
97+
var opts;
98+
var file;
99+
var str;
100+
101+
opts = {
102+
'dtype': 'float32',
103+
'encoding': 'utf8'
104+
};
105+
106+
fpath = resolve( __dirname, '..', 'lib', 'polyval_p.js' );
107+
str = header + compile( P );
108+
writeFileSync( fpath, str, opts );
109+
110+
fpath = resolve( __dirname, '..', 'lib', 'polyval_q.js' );
111+
str = header + compile( Q );
112+
writeFileSync( fpath, str, opts );
113+
114+
copts = {
115+
'dtype': 'float',
116+
'name': ''
117+
};
118+
119+
fpath = resolve( __dirname, '..', 'src', 'main.c' );
120+
file = readFileSync( fpath, opts );
121+
122+
copts.name = 'polyval_p';
123+
str = compileC( P, copts );
124+
file = insert( file, copts.name, str );
125+
126+
copts.name = 'polyval_q';
127+
str = compileC( Q, copts );
128+
file = insert( file, copts.name, str );
129+
130+
writeFileSync( fpath, file, opts );
131+
}
132+
133+
main();

0 commit comments

Comments
 (0)