@stdlib/math-base-napi-ternary 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/fif_f.c ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/math/base/napi/ternary/fif_f.h"
20
+ #include <node_api.h>
21
+ #include <stdint.h>
22
+ #include <assert.h>
23
+
24
+ /**
25
+ * Invokes a ternary function accepting a single-precision floating-point number, a signed 32-bit integer, and a single-precision floating-point number and returning a single-precision floating-point number.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
30
+ *
31
+ * - `x`: input value.
32
+ * - `y`: input value.
33
+ * - `z`: input value.
34
+ *
35
+ * @param env environment under which the function is invoked
36
+ * @param info callback data
37
+ * @param fcn ternary function
38
+ * @return function return value as a Node-API double-precision floating-point number
39
+ */
40
+ napi_value stdlib_math_base_napi_fif_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t, float ) ) {
41
+ napi_status status;
42
+
43
+ size_t argc = 3;
44
+ napi_value argv[ 3 ];
45
+ status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
46
+ assert( status == napi_ok );
47
+
48
+ if ( argc < 3 ) {
49
+ status = napi_throw_error( env, NULL, "invalid invocation. Must provide three numbers." );
50
+ assert( status == napi_ok );
51
+ return NULL;
52
+ }
53
+
54
+ napi_valuetype vtype0;
55
+ status = napi_typeof( env, argv[ 0 ], &vtype0 );
56
+ assert( status == napi_ok );
57
+ if ( vtype0 != napi_number ) {
58
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
59
+ assert( status == napi_ok );
60
+ return NULL;
61
+ }
62
+
63
+ napi_valuetype vtype1;
64
+ status = napi_typeof( env, argv[ 1 ], &vtype1 );
65
+ assert( status == napi_ok );
66
+ if ( vtype1 != napi_number ) {
67
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
68
+ assert( status == napi_ok );
69
+ return NULL;
70
+ }
71
+
72
+ napi_valuetype vtype2;
73
+ status = napi_typeof( env, argv[ 2 ], &vtype2 );
74
+ assert( status == napi_ok );
75
+ if ( vtype2 != napi_number ) {
76
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
77
+ assert( status == napi_ok );
78
+ return NULL;
79
+ }
80
+
81
+ double x;
82
+ status = napi_get_value_double( env, argv[ 0 ], &x );
83
+ assert( status == napi_ok );
84
+
85
+ int32_t y;
86
+ status = napi_get_value_int32( env, argv[ 1 ], &y );
87
+ assert( status == napi_ok );
88
+
89
+ double z;
90
+ status = napi_get_value_double( env, argv[ 2 ], &z );
91
+ assert( status == napi_ok );
92
+
93
+ napi_value v;
94
+ status = napi_create_double( env, (double)fcn( (float)x, y, (float)z ), &v );
95
+ assert( status == napi_ok );
96
+
97
+ return v;
98
+ }
package/src/fii_f.c ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/math/base/napi/ternary/fii_f.h"
20
+ #include <node_api.h>
21
+ #include <stdint.h>
22
+ #include <assert.h>
23
+
24
+ /**
25
+ * Invokes a ternary function accepting a single-precision floating-point number and two signed 32-bit integers and returning a single-precision floating-point number.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
30
+ *
31
+ * - `x`: input value.
32
+ * - `y`: input value.
33
+ * - `z`: input value.
34
+ *
35
+ * @param env environment under which the function is invoked
36
+ * @param info callback data
37
+ * @param fcn ternary function
38
+ * @return function return value as a Node-API double-precision floating-point number
39
+ */
40
+ napi_value stdlib_math_base_napi_fii_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t, int32_t ) ) {
41
+ napi_status status;
42
+
43
+ size_t argc = 3;
44
+ napi_value argv[ 3 ];
45
+ status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
46
+ assert( status == napi_ok );
47
+
48
+ if ( argc < 3 ) {
49
+ status = napi_throw_error( env, NULL, "invalid invocation. Must provide three numbers." );
50
+ assert( status == napi_ok );
51
+ return NULL;
52
+ }
53
+
54
+ napi_valuetype vtype0;
55
+ status = napi_typeof( env, argv[ 0 ], &vtype0 );
56
+ assert( status == napi_ok );
57
+ if ( vtype0 != napi_number ) {
58
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
59
+ assert( status == napi_ok );
60
+ return NULL;
61
+ }
62
+
63
+ napi_valuetype vtype1;
64
+ status = napi_typeof( env, argv[ 1 ], &vtype1 );
65
+ assert( status == napi_ok );
66
+ if ( vtype1 != napi_number ) {
67
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
68
+ assert( status == napi_ok );
69
+ return NULL;
70
+ }
71
+
72
+ napi_valuetype vtype2;
73
+ status = napi_typeof( env, argv[ 2 ], &vtype2 );
74
+ assert( status == napi_ok );
75
+ if ( vtype2 != napi_number ) {
76
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
77
+ assert( status == napi_ok );
78
+ return NULL;
79
+ }
80
+
81
+ double x;
82
+ status = napi_get_value_double( env, argv[ 0 ], &x );
83
+ assert( status == napi_ok );
84
+
85
+ int32_t y;
86
+ status = napi_get_value_int32( env, argv[ 1 ], &y );
87
+ assert( status == napi_ok );
88
+
89
+ int32_t z;
90
+ status = napi_get_value_int32( env, argv[ 2 ], &z );
91
+ assert( status == napi_ok );
92
+
93
+ napi_value v;
94
+ status = napi_create_double( env, (double)fcn( (float)x, y, z ), &v );
95
+ assert( status == napi_ok );
96
+
97
+ return v;
98
+ }
package/src/iid_d.c ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2020 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
+ #include "stdlib/math/base/napi/ternary/iid_d.h"
20
+ #include <node_api.h>
21
+ #include <stdint.h>
22
+ #include <assert.h>
23
+
24
+ /**
25
+ * Invokes a ternary function accepting two signed 32-bit integers and a double-precision floating-point number and returning a double-precision floating-point number.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
30
+ *
31
+ * - `x`: input value.
32
+ * - `y`: input value.
33
+ * - `z`: input value.
34
+ *
35
+ * @param env environment under which the function is invoked
36
+ * @param info callback data
37
+ * @param fcn ternary function
38
+ * @return function return value as a Node-API double-precision floating-point number
39
+ */
40
+ napi_value stdlib_math_base_napi_iid_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, double ) ) {
41
+ napi_status status;
42
+
43
+ size_t argc = 3;
44
+ napi_value argv[ 3 ];
45
+ status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
46
+ assert( status == napi_ok );
47
+
48
+ if ( argc < 3 ) {
49
+ status = napi_throw_error( env, NULL, "invalid invocation. Must provide three numbers." );
50
+ assert( status == napi_ok );
51
+ return NULL;
52
+ }
53
+
54
+ napi_valuetype vtype0;
55
+ status = napi_typeof( env, argv[ 0 ], &vtype0 );
56
+ assert( status == napi_ok );
57
+ if ( vtype0 != napi_number ) {
58
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
59
+ assert( status == napi_ok );
60
+ return NULL;
61
+ }
62
+
63
+ napi_valuetype vtype1;
64
+ status = napi_typeof( env, argv[ 1 ], &vtype1 );
65
+ assert( status == napi_ok );
66
+ if ( vtype1 != napi_number ) {
67
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
68
+ assert( status == napi_ok );
69
+ return NULL;
70
+ }
71
+
72
+ napi_valuetype vtype2;
73
+ status = napi_typeof( env, argv[ 2 ], &vtype2 );
74
+ assert( status == napi_ok );
75
+ if ( vtype2 != napi_number ) {
76
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
77
+ assert( status == napi_ok );
78
+ return NULL;
79
+ }
80
+
81
+ int32_t x;
82
+ status = napi_get_value_int32( env, argv[ 0 ], &x );
83
+ assert( status == napi_ok );
84
+
85
+ int32_t y;
86
+ status = napi_get_value_int32( env, argv[ 1 ], &y );
87
+ assert( status == napi_ok );
88
+
89
+ double z;
90
+ status = napi_get_value_double( env, argv[ 2 ], &z );
91
+ assert( status == napi_ok );
92
+
93
+ napi_value v;
94
+ status = napi_create_double( env, fcn( x, y, z ), &v );
95
+ assert( status == napi_ok );
96
+
97
+ return v;
98
+ }
package/src/iii_d.c ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ #include "stdlib/math/base/napi/ternary/iii_d.h"
20
+ #include <node_api.h>
21
+ #include <stdint.h>
22
+ #include <assert.h>
23
+
24
+ /**
25
+ * Invokes a ternary function accepting three signed 32-bit integers and returning a double-precision floating-point number.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
30
+ *
31
+ * - `x`: input value.
32
+ * - `y`: input value.
33
+ * - `z`: input value.
34
+ *
35
+ * @param env environment under which the function is invoked
36
+ * @param info callback data
37
+ * @param fcn ternary function
38
+ * @return function return value as a Node-API double-precision floating-point number
39
+ */
40
+ napi_value stdlib_math_base_napi_iii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, int32_t ) ) {
41
+ napi_status status;
42
+
43
+ size_t argc = 3;
44
+ napi_value argv[ 3 ];
45
+ status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
46
+ assert( status == napi_ok );
47
+
48
+ if ( argc < 3 ) {
49
+ status = napi_throw_error( env, NULL, "invalid invocation. Must provide three numbers." );
50
+ assert( status == napi_ok );
51
+ return NULL;
52
+ }
53
+
54
+ napi_valuetype vtype0;
55
+ status = napi_typeof( env, argv[ 0 ], &vtype0 );
56
+ assert( status == napi_ok );
57
+ if ( vtype0 != napi_number ) {
58
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
59
+ assert( status == napi_ok );
60
+ return NULL;
61
+ }
62
+
63
+ napi_valuetype vtype1;
64
+ status = napi_typeof( env, argv[ 1 ], &vtype1 );
65
+ assert( status == napi_ok );
66
+ if ( vtype1 != napi_number ) {
67
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
68
+ assert( status == napi_ok );
69
+ return NULL;
70
+ }
71
+
72
+ napi_valuetype vtype2;
73
+ status = napi_typeof( env, argv[ 2 ], &vtype2 );
74
+ assert( status == napi_ok );
75
+ if ( vtype2 != napi_number ) {
76
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
77
+ assert( status == napi_ok );
78
+ return NULL;
79
+ }
80
+
81
+ int32_t x;
82
+ status = napi_get_value_int32( env, argv[ 0 ], &x );
83
+ assert( status == napi_ok );
84
+
85
+ int32_t y;
86
+ status = napi_get_value_int32( env, argv[ 1 ], &y );
87
+ assert( status == napi_ok );
88
+
89
+ int32_t z;
90
+ status = napi_get_value_int32( env, argv[ 2 ], &z );
91
+ assert( status == napi_ok );
92
+
93
+ napi_value v;
94
+ status = napi_create_double( env, fcn( x, y, z ), &v );
95
+ assert( status == napi_ok );
96
+
97
+ return v;
98
+ }
package/src/zzz_z.c ADDED
@@ -0,0 +1,230 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2020 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
+ #include "stdlib/math/base/napi/ternary/zzz_z.h"
20
+ #include "stdlib/complex/float64/ctor.h"
21
+ #include "stdlib/complex/float64/reim.h"
22
+ #include <node_api.h>
23
+ #include <assert.h>
24
+
25
+ /**
26
+ * Invokes a ternary function accepting and returning double-precision complex floating-point numbers.
27
+ *
28
+ * ## Notes
29
+ *
30
+ * - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
31
+ *
32
+ * - `x`: input value.
33
+ * - `y`: input value.
34
+ * - `z`: input value.
35
+ *
36
+ * @param env environment under which the function is invoked
37
+ * @param info callback data
38
+ * @param fcn ternary function
39
+ * @return function return value as a Node-API complex-like object
40
+ */
41
+ napi_value stdlib_math_base_napi_zzz_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, stdlib_complex128_t, stdlib_complex128_t ) ) {
42
+ napi_status status;
43
+
44
+ size_t argc = 3;
45
+ napi_value argv[ 3 ];
46
+ status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
47
+ assert( status == napi_ok );
48
+
49
+ if ( argc < 3 ) {
50
+ status = napi_throw_error( env, NULL, "invalid invocation. Must provide three complex numbers." );
51
+ assert( status == napi_ok );
52
+ return NULL;
53
+ }
54
+
55
+ bool hprop;
56
+ status = napi_has_named_property( env, argv[ 0 ], "re", &hprop );
57
+ assert( status == napi_ok );
58
+ if ( !hprop ) {
59
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must have a real component." );
60
+ assert( status == napi_ok );
61
+ return NULL;
62
+ }
63
+
64
+ napi_value xre;
65
+ status = napi_get_named_property( env, argv[ 0 ], "re", &xre );
66
+ assert( status == napi_ok );
67
+
68
+ napi_valuetype xretype;
69
+ status = napi_typeof( env, xre, &xretype );
70
+ assert( status == napi_ok );
71
+ if ( xretype != napi_number ) {
72
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must have a real component which is a number." );
73
+ assert( status == napi_ok );
74
+ return NULL;
75
+ }
76
+
77
+ status = napi_has_named_property( env, argv[ 0 ], "im", &hprop );
78
+ assert( status == napi_ok );
79
+ if ( !hprop ) {
80
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must have an imaginary component." );
81
+ assert( status == napi_ok );
82
+ return NULL;
83
+ }
84
+
85
+ napi_value xim;
86
+ status = napi_get_named_property( env, argv[ 0 ], "im", &xim );
87
+ assert( status == napi_ok );
88
+
89
+ napi_valuetype ximtype;
90
+ status = napi_typeof( env, xim, &ximtype );
91
+ assert( status == napi_ok );
92
+ if ( ximtype != napi_number ) {
93
+ status = napi_throw_type_error( env, NULL, "invalid argument. First argument must have an imaginary component which a number." );
94
+ assert( status == napi_ok );
95
+ return NULL;
96
+ }
97
+
98
+ status = napi_has_named_property( env, argv[ 1 ], "re", &hprop );
99
+ assert( status == napi_ok );
100
+ if ( !hprop ) {
101
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must have a real component." );
102
+ assert( status == napi_ok );
103
+ return NULL;
104
+ }
105
+
106
+ napi_value yre;
107
+ status = napi_get_named_property( env, argv[ 1 ], "re", &yre );
108
+ assert( status == napi_ok );
109
+
110
+ napi_valuetype yretype;
111
+ status = napi_typeof( env, yre, &yretype );
112
+ assert( status == napi_ok );
113
+ if ( yretype != napi_number ) {
114
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must have a real component which is a number." );
115
+ assert( status == napi_ok );
116
+ return NULL;
117
+ }
118
+
119
+ status = napi_has_named_property( env, argv[ 1 ], "im", &hprop );
120
+ assert( status == napi_ok );
121
+ if ( !hprop ) {
122
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must have an imaginary component." );
123
+ assert( status == napi_ok );
124
+ return NULL;
125
+ }
126
+
127
+ napi_value yim;
128
+ status = napi_get_named_property( env, argv[ 1 ], "im", &yim );
129
+ assert( status == napi_ok );
130
+
131
+ napi_valuetype yimtype;
132
+ status = napi_typeof( env, yim, &yimtype );
133
+ assert( status == napi_ok );
134
+ if ( yimtype != napi_number ) {
135
+ status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must have an imaginary component which a number." );
136
+ assert( status == napi_ok );
137
+ return NULL;
138
+ }
139
+
140
+ status = napi_has_named_property( env, argv[ 2 ], "re", &hprop );
141
+ assert( status == napi_ok );
142
+ if ( !hprop ) {
143
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must have a real component." );
144
+ assert( status == napi_ok );
145
+ return NULL;
146
+ }
147
+
148
+ napi_value zre;
149
+ status = napi_get_named_property( env, argv[ 2 ], "re", &zre );
150
+ assert( status == napi_ok );
151
+
152
+ napi_valuetype zretype;
153
+ status = napi_typeof( env, zre, &zretype );
154
+ assert( status == napi_ok );
155
+ if ( zretype != napi_number ) {
156
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must have a real component which is a number." );
157
+ assert( status == napi_ok );
158
+ return NULL;
159
+ }
160
+
161
+ status = napi_has_named_property( env, argv[ 2 ], "im", &hprop );
162
+ assert( status == napi_ok );
163
+ if ( !hprop ) {
164
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must have an imaginary component." );
165
+ assert( status == napi_ok );
166
+ return NULL;
167
+ }
168
+
169
+ napi_value zim;
170
+ status = napi_get_named_property( env, argv[ 2 ], "im", &zim );
171
+ assert( status == napi_ok );
172
+
173
+ napi_valuetype zimtype;
174
+ status = napi_typeof( env, zim, &zimtype );
175
+ assert( status == napi_ok );
176
+ if ( zimtype != napi_number ) {
177
+ status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must have an imaginary component which a number." );
178
+ assert( status == napi_ok );
179
+ return NULL;
180
+ }
181
+
182
+ double re0;
183
+ status = napi_get_value_double( env, xre, &re0 );
184
+ assert( status == napi_ok );
185
+
186
+ double im0;
187
+ status = napi_get_value_double( env, xim, &im0 );
188
+ assert( status == napi_ok );
189
+
190
+ double re1;
191
+ status = napi_get_value_double( env, yre, &re1 );
192
+ assert( status == napi_ok );
193
+
194
+ double im1;
195
+ status = napi_get_value_double( env, yim, &im1 );
196
+ assert( status == napi_ok );
197
+
198
+ double re2;
199
+ status = napi_get_value_double( env, zre, &re2 );
200
+ assert( status == napi_ok );
201
+
202
+ double im2;
203
+ status = napi_get_value_double( env, zim, &im2 );
204
+ assert( status == napi_ok );
205
+
206
+ stdlib_complex128_t v = fcn( stdlib_complex128( re0, im0 ), stdlib_complex128( re1, im1 ), stdlib_complex128( re2, im2 ) );
207
+ double re;
208
+ double im;
209
+ stdlib_complex128_reim( v, &re, &im );
210
+
211
+ napi_value obj;
212
+ status = napi_create_object( env, &obj );
213
+ assert( status == napi_ok );
214
+
215
+ napi_value vre;
216
+ status = napi_create_double( env, re, &vre );
217
+ assert( status == napi_ok );
218
+
219
+ status = napi_set_named_property( env, obj, "re", vre );
220
+ assert( status == napi_ok );
221
+
222
+ napi_value vim;
223
+ status = napi_create_double( env, im, &vim );
224
+ assert( status == napi_ok );
225
+
226
+ status = napi_set_named_property( env, obj, "im", vim );
227
+ assert( status == napi_ok );
228
+
229
+ return obj;
230
+ }
package/include.gypi DELETED
@@ -1,53 +0,0 @@
1
- # @license Apache-2.0
2
- #
3
- # Copyright (c) 2020 The Stdlib Authors.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- # A GYP include file for building a Node.js native add-on.
18
- #
19
- # Main documentation:
20
- #
21
- # [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
22
- # [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
23
- {
24
- # Define variables to be used throughout the configuration for all targets:
25
- 'variables': {
26
- # Source directory:
27
- 'src_dir': './src',
28
-
29
- # Include directories:
30
- 'include_dirs': [
31
- '<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
32
- ],
33
-
34
- # Add-on destination directory:
35
- 'addon_output_dir': './src',
36
-
37
- # Source files:
38
- 'src_files': [
39
- '<(src_dir)/addon.c',
40
- '<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
41
- ],
42
-
43
- # Library dependencies:
44
- 'libraries': [
45
- '<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
46
- ],
47
-
48
- # Library directories:
49
- 'library_dirs': [
50
- '<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
51
- ],
52
- }, # end variables
53
- }