Skip to content

Commit 6364726

Browse files
committed
docs: update README with documentation for DIII_D macro
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 3e62adf commit 6364726

File tree

1 file changed

+60
-0
lines changed
  • lib/node_modules/@stdlib/math/base/napi/quaternary

1 file changed

+60
-0
lines changed

lib/node_modules/@stdlib/math/base/napi/quaternary/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,66 @@ The function accepts the following arguments:
166166
void stdlib_math_base_napi_dddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double ) );
167167
```
168168
169+
#### STDLIB_MATH_BASE_NAPI_MODULE_DIII_D( fcn )
170+
171+
Macro for registering a Node-API module exporting an interface invoking a quaternary function accepting a double-precision floating-point number and three signed 32-bit integers and returning a double-precision floating-point number.
172+
173+
```c
174+
static double add( const double x, const int32_t y, const int32_t z, const int32_t w ) {
175+
return x + y + z + w;
176+
}
177+
178+
// ...
179+
180+
// Register a Node-API module:
181+
STDLIB_MATH_BASE_NAPI_MODULE_DIII_D( add );
182+
```
183+
184+
The macro expects the following arguments:
185+
186+
- **fcn**: `double (*fcn)( double, int32_t, int32_t, int32_t )` quaternary function.
187+
188+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
189+
190+
#### stdlib_math_base_napi_diii_d( env, info, fcn )
191+
192+
Invokes a quaternary function accepting a double-precision floating-point number and three signed 32-bit integers and returning a double-precision floating-point number.
193+
194+
```c
195+
#include <node_api.h>
196+
197+
// ...
198+
199+
static double add( const double x, const int32_t y, const int32_t z, const int32_t w ) {
200+
return x + y + z + w;
201+
}
202+
203+
// ...
204+
205+
/**
206+
* Receives JavaScript callback invocation data.
207+
*
208+
* @param env environment under which the function is invoked
209+
* @param info callback data
210+
* @return Node-API value
211+
*/
212+
napi_value addon( napi_env env, napi_callback_info info ) {
213+
return stdlib_math_base_napi_diii_d( env, info, add );
214+
}
215+
216+
// ...
217+
```
218+
219+
The function accepts the following arguments:
220+
221+
- **env**: `[in] napi_env` environment under which the function is invoked.
222+
- **info**: `[in] napi_callback_info` callback data.
223+
- **fcn**: `[in] double (*fcn)( double, int32_t, int32_t, int32_t )` quaternary function.
224+
225+
```c
226+
void stdlib_math_base_napi_diii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t, int32_t ) );
227+
```
228+
169229
#### STDLIB_MATH_BASE_NAPI_MODULE_FFFF_F( fcn )
170230

171231
Macro for registering a Node-API module exporting an interface for invoking a quaternary function accepting and returning single-precision floating-point numbers.

0 commit comments

Comments
 (0)