Skip to content

Commit 8e5f66b

Browse files
authored
Merge pull request #5734 from gururaj1512/migrate-math-base-ops-imul
PR-URL: #5734 Ref: #2261 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
2 parents 1229ea7 + a63fd20 commit 8e5f66b

File tree

49 files changed

+112
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+112
-125
lines changed
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
{
2-
"E": "@stdlib/constants/float64/e",
3-
"LN2": "@stdlib/constants/float64/ln-two",
4-
"LN10": "@stdlib/constants/float64/ln-ten",
5-
"LOG2E": "@stdlib/constants/float64/log2-e",
6-
"LOG10E": "@stdlib/constants/float64/log10-e",
7-
"PI": "@stdlib/constants/float64/pi",
8-
"SQRT1_2": "@stdlib/constants/float64/sqrt-half",
9-
"SQRT2": "@stdlib/constants/float64/sqrt-two",
10-
"abs": "@stdlib/math/base/special/abs",
11-
"acos": "@stdlib/math/base/special/acos",
12-
"acosh": "@stdlib/math/base/special/acosh",
13-
"asin": "@stdlib/math/base/special/asin",
14-
"asinh": "@stdlib/math/base/special/asinh",
15-
"atan": "@stdlib/math/base/special/atan",
16-
"atanh": "@stdlib/math/base/special/atanh",
17-
"atan2": "@stdlib/math/base/special/atan2",
18-
"cbrt": "@stdlib/math/base/special/cbrt",
19-
"ceil": "@stdlib/math/base/special/ceil",
20-
"cos": "@stdlib/math/base/special/cos",
21-
"cosh": "@stdlib/math/base/special/cosh",
22-
"exp": "@stdlib/math/base/special/exp",
23-
"expm1": "@stdlib/math/base/special/expm1",
24-
"floor": "@stdlib/math/base/special/floor",
25-
"fround": "@stdlib/number/float64/base/to-float32",
26-
"hypot": "@stdlib/math/base/special/hypot",
27-
"imul": "@stdlib/math/base/ops/imul",
28-
"log": "@stdlib/math/base/special/ln",
29-
"log1p": "@stdlib/math/base/special/log1p",
30-
"log10": "@stdlib/math/base/special/log10",
31-
"log2": "@stdlib/math/base/special/log2",
32-
"max": "@stdlib/math/base/special/max",
33-
"min": "@stdlib/math/base/special/min",
34-
"pow": "@stdlib/math/base/special/pow",
35-
"random": "@stdlib/random/base/randu",
36-
"round": "@stdlib/math/base/special/round",
37-
"sign": "@stdlib/math/base/special/signum",
38-
"sin": "@stdlib/math/base/special/sin",
39-
"sinh": "@stdlib/math/base/special/sinh",
40-
"sqrt": "@stdlib/math/base/special/sqrt",
41-
"tan": "@stdlib/math/base/special/tan",
42-
"tanh": "@stdlib/math/base/special/tanh",
43-
"trunc": "@stdlib/math/base/special/trunc"
2+
"E": "@stdlib/constants/float64/e",
3+
"LN2": "@stdlib/constants/float64/ln-two",
4+
"LN10": "@stdlib/constants/float64/ln-ten",
5+
"LOG2E": "@stdlib/constants/float64/log2-e",
6+
"LOG10E": "@stdlib/constants/float64/log10-e",
7+
"PI": "@stdlib/constants/float64/pi",
8+
"SQRT1_2": "@stdlib/constants/float64/sqrt-half",
9+
"SQRT2": "@stdlib/constants/float64/sqrt-two",
10+
"abs": "@stdlib/math/base/special/abs",
11+
"acos": "@stdlib/math/base/special/acos",
12+
"acosh": "@stdlib/math/base/special/acosh",
13+
"asin": "@stdlib/math/base/special/asin",
14+
"asinh": "@stdlib/math/base/special/asinh",
15+
"atan": "@stdlib/math/base/special/atan",
16+
"atanh": "@stdlib/math/base/special/atanh",
17+
"atan2": "@stdlib/math/base/special/atan2",
18+
"cbrt": "@stdlib/math/base/special/cbrt",
19+
"ceil": "@stdlib/math/base/special/ceil",
20+
"cos": "@stdlib/math/base/special/cos",
21+
"cosh": "@stdlib/math/base/special/cosh",
22+
"exp": "@stdlib/math/base/special/exp",
23+
"expm1": "@stdlib/math/base/special/expm1",
24+
"floor": "@stdlib/math/base/special/floor",
25+
"fround": "@stdlib/number/float64/base/to-float32",
26+
"hypot": "@stdlib/math/base/special/hypot",
27+
"imul": "@stdlib/number/int32/base/mul",
28+
"log": "@stdlib/math/base/special/ln",
29+
"log1p": "@stdlib/math/base/special/log1p",
30+
"log10": "@stdlib/math/base/special/log10",
31+
"log2": "@stdlib/math/base/special/log2",
32+
"max": "@stdlib/math/base/special/max",
33+
"min": "@stdlib/math/base/special/min",
34+
"pow": "@stdlib/math/base/special/pow",
35+
"random": "@stdlib/random/base/randu",
36+
"round": "@stdlib/math/base/special/round",
37+
"sign": "@stdlib/math/base/special/signum",
38+
"sin": "@stdlib/math/base/special/sin",
39+
"sinh": "@stdlib/math/base/special/sinh",
40+
"sqrt": "@stdlib/math/base/special/sqrt",
41+
"tan": "@stdlib/math/base/special/tan",
42+
"tanh": "@stdlib/math/base/special/tanh",
43+
"trunc": "@stdlib/math/base/special/trunc"
4444
}

lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-math/test/fixtures/invalid.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
'use strict';
2020

2121
var invalid = [];
22-
var test;
2322

24-
test = {
23+
var test = {
2524
'code': [
2625
'// VARIABLES //',
2726
'',
@@ -91,6 +90,21 @@ test = {
9190
};
9291
invalid.push( test );
9392

93+
test = {
94+
'code': [
95+
'// VARIABLES //',
96+
'',
97+
'var out = Math.imul( -5, 12 );'
98+
].join( '\n' ),
99+
'errors': [
100+
{
101+
'message': 'Use the package `@stdlib/number/int32/base/mul` instead of `Math.imul`',
102+
'type': 'MemberExpression'
103+
}
104+
]
105+
};
106+
invalid.push( test );
107+
94108

95109
// EXPORTS //
96110

lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-math/test/fixtures/unvalidated.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
'use strict';
2020

2121
var valid = [];
22-
var test;
2322

24-
test = {
23+
var test = {
2524
'code': [
2625
'// VARIABLES //',
2726
'',

lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-math/test/fixtures/valid.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
'use strict';
2020

2121
var valid = [];
22-
var test;
2322

24-
test = {
23+
var test = {
2524
'code': [
2625
'// VARIABLES //',
2726
'',
@@ -52,7 +51,7 @@ test = {
5251
'code': [
5352
'// VARIABLES //',
5453
'',
55-
'var out = Math.imul( -5, 12 );' // TODO: remove once an equivalent to `Math.imul` is present in the project
54+
'var out = imul( -5, 12 );'
5655
].join( '\n' )
5756
};
5857
valid.push( test );

lib/node_modules/@stdlib/math/base/ops/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The namespace contains the following functions:
5050
- <span class="signature">[`cnegf( z )`][@stdlib/math/base/ops/cnegf]</span><span class="delimiter">: </span><span class="description">negate a single-precision complex floating-point number.</span>
5151
- <span class="signature">[`csub( z1, z2 )`][@stdlib/math/base/ops/csub]</span><span class="delimiter">: </span><span class="description">subtract two double-precision complex floating-point numbers.</span>
5252
- <span class="signature">[`csubf( z1, z2 )`][@stdlib/math/base/ops/csubf]</span><span class="delimiter">: </span><span class="description">subtract two single-precision complex floating-point numbers.</span>
53-
- <span class="signature">[`imul( a, b )`][@stdlib/math/base/ops/imul]</span><span class="delimiter">: </span><span class="description">perform C-like multiplication of two signed 32-bit integers.</span>
53+
- <span class="signature">[`imul( a, b )`][@stdlib/number/int32/base/mul]</span><span class="delimiter">: </span><span class="description">perform C-like multiplication of two signed 32-bit integers.</span>
5454
- <span class="signature">[`imuldw( a, b )`][@stdlib/math/base/ops/imuldw]</span><span class="delimiter">: </span><span class="description">compute the double word product of two signed 32-bit integers.</span>
5555
- <span class="signature">[`umuldw( a, b )`][@stdlib/math/base/ops/umuldw]</span><span class="delimiter">: </span><span class="description">compute the double word product of two unsigned 32-bit integers.</span>
5656

@@ -86,11 +86,6 @@ var z2 = new Complex128( -2.0, 1.0 );
8686
console.log( ns.cmul( z1, z2 ) ); // { 're': -13.0, 'im': -1.0 }
8787
// => <Complex128>
8888

89-
// Operations for signed 32-bit integers:
90-
// 2^30 * -5 = -5368709120 => 32-bit integer overflow
91-
console.log( ns.imul( 1073741824|0, -5|0 ) );
92-
// => -1073741824
93-
9489
// Operations for double word product:
9590
// -(2^31) * 2^30 = -2305843009213694000 => 32-bit integer overflow
9691
console.log( ns.imuldw( 0x80000000|0, 0x40000000|0 ) );
@@ -125,7 +120,7 @@ console.log( ns.imuldw( 0x80000000|0, 0x40000000|0 ) );
125120

126121
[@stdlib/math/base/ops/csubf]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/csubf
127122

128-
[@stdlib/math/base/ops/imul]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/imul
123+
[@stdlib/number/int32/base/mul]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/int32/base/mul
129124

130125
[@stdlib/math/base/ops/imuldw]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/imuldw
131126

lib/node_modules/@stdlib/math/base/ops/docs/types/index.d.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import cneg = require( '@stdlib/math/base/ops/cneg' );
2929
import cnegf = require( '@stdlib/math/base/ops/cnegf' );
3030
import csub = require( '@stdlib/math/base/ops/csub' );
3131
import csubf = require( '@stdlib/math/base/ops/csubf' );
32-
import imul = require( '@stdlib/math/base/ops/imul' );
3332
import imuldw = require( '@stdlib/math/base/ops/imuldw' );
3433
import umuldw = require( '@stdlib/math/base/ops/umuldw' );
3534
import divf = require( '@stdlib/number/float32/base/div' );
@@ -413,19 +412,6 @@ interface Namespace {
413412
*/
414413
csubf: typeof csubf;
415414

416-
/**
417-
* Performs C-like multiplication of two signed 32-bit integers.
418-
*
419-
* @param a - signed 32-bit integer
420-
* @param b - signed 32-bit integer
421-
* @returns product
422-
*
423-
* @example
424-
* var v = ns.imul( -10|0, 4|0 );
425-
* // returns -40
426-
*/
427-
imul: typeof imul;
428-
429415
/**
430416
* Performs multiplication of two signed 32-bit integers and returns an array of two signed 32-bit integers which represents the signed 64-bit integer product.
431417
*

lib/node_modules/@stdlib/math/base/ops/imuldw/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ for ( i = 0x7FFFFFF0; i < 0x7FFFFFFF; i++ ) {
110110

111111
## See Also
112112

113-
- <span class="package-name">[`@stdlib/math/base/ops/imul`][@stdlib/math/base/ops/imul]</span><span class="delimiter">: </span><span class="description">perform C-like multiplication of two signed 32-bit integers.</span>
113+
- <span class="package-name">[`@stdlib/number/int32/base/mul`][@stdlib/number/int32/base/mul]</span><span class="delimiter">: </span><span class="description">perform C-like multiplication of two signed 32-bit integers.</span>
114114

115115
</section>
116116

@@ -124,7 +124,7 @@ for ( i = 0x7FFFFFF0; i < 0x7FFFFFFF; i++ ) {
124124

125125
<!-- <related-links> -->
126126

127-
[@stdlib/math/base/ops/imul]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/imul
127+
[@stdlib/number/int32/base/mul]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/int32/base/mul
128128

129129
<!-- </related-links> -->
130130

lib/node_modules/@stdlib/math/base/ops/lib/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,6 @@ setReadOnly( ns, 'csub', require( '@stdlib/math/base/ops/csub' ) );
117117
*/
118118
setReadOnly( ns, 'csubf', require( '@stdlib/math/base/ops/csubf' ) );
119119

120-
/**
121-
* @name imul
122-
* @memberof ns
123-
* @readonly
124-
* @type {Function}
125-
* @see {@link module:@stdlib/math/base/ops/imul}
126-
*/
127-
setReadOnly( ns, 'imul', require( '@stdlib/math/base/ops/imul' ) );
128-
129120
/**
130121
* @name imuldw
131122
* @memberof ns

lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ base.hypot,"@stdlib/math/base/special/hypot"
804804
base.hypotf,"@stdlib/math/base/special/hypotf"
805805
base.identity,"@stdlib/math/base/special/identity"
806806
base.identityf,"@stdlib/math/base/special/identityf"
807-
base.imul,"@stdlib/math/base/ops/imul"
807+
base.imul,"@stdlib/number/int32/base/mul"
808808
base.imuldw,"@stdlib/math/base/ops/imuldw"
809809
base.int2slice,"@stdlib/slice/base/int2slice"
810810
base.int32ToUint32,"@stdlib/number/int32/base/to-uint32"

lib/node_modules/@stdlib/namespace/alias2pkg/data/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)