From 2a27f462d36b4bbb0d0ac455ed5529ddda1bcc53 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 8 Feb 2025 23:23:12 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 184 +++++++++++++++ base/ops/README.md | 4 +- base/ops/add4/README.md | 221 ------------------ base/ops/add4/benchmark/benchmark.js | 72 ------ base/ops/add4/benchmark/benchmark.native.js | 60 ----- base/ops/add4/benchmark/c/Makefile | 126 ---------- base/ops/add4/benchmark/c/benchmark.c | 141 ----------- base/ops/add4/benchmark/c/native/Makefile | 146 ------------ base/ops/add4/benchmark/c/native/benchmark.c | 133 ----------- base/ops/add4/binding.gyp | 170 -------------- base/ops/add4/docs/repl.txt | 39 ---- base/ops/add4/docs/types/index.d.ts | 55 ----- base/ops/add4/docs/types/test.ts | 84 ------- base/ops/add4/examples/c/Makefile | 146 ------------ base/ops/add4/examples/c/example.c | 34 --- base/ops/add4/examples/index.js | 33 --- base/ops/add4/include.gypi | 53 ----- .../add4/include/stdlib/math/base/ops/add4.h | 38 --- base/ops/add4/lib/index.js | 52 ----- base/ops/add4/lib/main.js | 59 ----- base/ops/add4/lib/native.js | 65 ------ base/ops/add4/manifest.json | 67 ------ base/ops/add4/package.json | 68 ------ base/ops/add4/src/Makefile | 70 ------ base/ops/add4/src/addon.c | 23 -- base/ops/add4/src/main.c | 36 --- base/ops/add4/test/test.js | 90 ------- base/ops/add4/test/test.native.js | 99 -------- base/ops/docs/types/index.d.ts | 2 +- base/ops/lib/index.js | 9 - 30 files changed, 187 insertions(+), 2192 deletions(-) delete mode 100644 base/ops/add4/README.md delete mode 100644 base/ops/add4/benchmark/benchmark.js delete mode 100644 base/ops/add4/benchmark/benchmark.native.js delete mode 100644 base/ops/add4/benchmark/c/Makefile delete mode 100644 base/ops/add4/benchmark/c/benchmark.c delete mode 100644 base/ops/add4/benchmark/c/native/Makefile delete mode 100644 base/ops/add4/benchmark/c/native/benchmark.c delete mode 100644 base/ops/add4/binding.gyp delete mode 100644 base/ops/add4/docs/repl.txt delete mode 100644 base/ops/add4/docs/types/index.d.ts delete mode 100644 base/ops/add4/docs/types/test.ts delete mode 100644 base/ops/add4/examples/c/Makefile delete mode 100644 base/ops/add4/examples/c/example.c delete mode 100644 base/ops/add4/examples/index.js delete mode 100644 base/ops/add4/include.gypi delete mode 100644 base/ops/add4/include/stdlib/math/base/ops/add4.h delete mode 100644 base/ops/add4/lib/index.js delete mode 100644 base/ops/add4/lib/main.js delete mode 100644 base/ops/add4/lib/native.js delete mode 100644 base/ops/add4/manifest.json delete mode 100644 base/ops/add4/package.json delete mode 100644 base/ops/add4/src/Makefile delete mode 100644 base/ops/add4/src/addon.c delete mode 100644 base/ops/add4/src/main.c delete mode 100644 base/ops/add4/test/test.js delete mode 100644 base/ops/add4/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index cf78f18fc..3049493ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -249,6 +249,107 @@ +
+ +#### [@stdlib/math/base/ops/add4](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/add4) + +
+ +
+ +##### BREAKING CHANGES + +- [`e621529`](https://github.com/stdlib-js/stdlib/commit/e6215295bef94ff94f5b6d7a893c99283725d7c9): remove `math/base/ops/add4` + + - To migrate, users should update their require/import paths to use + `@stdlib/number/float64/base/add4` which provides the same API and + implementation. + Ref: https://github.com/stdlib-js/stdlib/issues/2261 + --- + 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: na + - 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: 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 + --- + +
+ + + +
+ +
+ + +
#### [@stdlib/math/base/ops/cdiv](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/ops/cdiv) @@ -2980,6 +3081,87 @@ This release closes the following issue: ### BREAKING CHANGES +- [`e621529`](https://github.com/stdlib-js/stdlib/commit/e6215295bef94ff94f5b6d7a893c99283725d7c9): remove `math/base/ops/add4` + + - To migrate, users should update their require/import paths to use + `@stdlib/number/float64/base/add4` which provides the same API and + implementation. + Ref: https://github.com/stdlib-js/stdlib/issues/2261 + --- + 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: na + - 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: 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 + --- + - [`b253140`](https://github.com/stdlib-js/stdlib/commit/b253140185322817c25fd8e3bb238703d013727a): remove `math/base/ops/add` - To migrate, users should update their require/import paths to use @@ -3112,6 +3294,8 @@ A total of 10 people contributed to this release. Thank you to the following con
+- [`e621529`](https://github.com/stdlib-js/stdlib/commit/e6215295bef94ff94f5b6d7a893c99283725d7c9) - **remove:** remove `math/base/ops/add4` _(by gururaj1512)_ +- [`60334d6`](https://github.com/stdlib-js/stdlib/commit/60334d6d17a9f29c0045c139b8ede24d1182b870) - **refactor:** update paths _(by gururaj1512)_ - [`ba0c854`](https://github.com/stdlib-js/stdlib/commit/ba0c854e87d0e86d0f7739e26095ec0a0f40c36f) - **docs:** fix function names in C example code _(by Philipp Burckhardt)_ - [`58e26cb`](https://github.com/stdlib-js/stdlib/commit/58e26cbf1882734b423124a001180661a6c377bb) - **chore:** fix parameter names, return annotations, and example code _(by Philipp Burckhardt)_ - [`b253140`](https://github.com/stdlib-js/stdlib/commit/b253140185322817c25fd8e3bb238703d013727a) - **remove:** remove `math/base/ops/add` _(by gururaj1512)_ diff --git a/base/ops/README.md b/base/ops/README.md index 893b13d8f..3d56a821f 100644 --- a/base/ops/README.md +++ b/base/ops/README.md @@ -47,7 +47,7 @@ The namespace contains the following functions: - [`add( x, y )`][@stdlib/number/float64/base/add]: compute the sum of two double-precision floating-point numbers. - [`add3( x, y, z )`][@stdlib/math/base/ops/add3]: compute the sum of three double-precision floating-point numbers. -- [`add4( x, y, z, w )`][@stdlib/math/base/ops/add4]: compute the sum of four double-precision floating-point numbers. +- [`add4( x, y, z, w )`][@stdlib/number/float64/base/add4]: compute the sum of four double-precision floating-point numbers. - [`add5( x, y, z, w, u )`][@stdlib/math/base/ops/add5]: compute the sum of five double-precision floating-point numbers. - [`addf( x, y )`][@stdlib/math/base/ops/addf]: compute the sum of two single-precision floating-point numbers. - [`cdiv( z1, z2 )`][@stdlib/math/base/ops/cdiv]: divide two double-precision complex floating-point numbers. @@ -140,7 +140,7 @@ console.log( ns.imuldw( 0x80000000|0, 0x40000000|0 ) ); [@stdlib/math/base/ops/add3]: https://github.com/stdlib-js/math/tree/main/base/ops/add3 -[@stdlib/math/base/ops/add4]: https://github.com/stdlib-js/math/tree/main/base/ops/add4 +[@stdlib/number/float64/base/add4]: https://github.com/stdlib-js/number-float64-base-add4 [@stdlib/math/base/ops/add5]: https://github.com/stdlib-js/math/tree/main/base/ops/add5 diff --git a/base/ops/add4/README.md b/base/ops/add4/README.md deleted file mode 100644 index cb8ba1294..000000000 --- a/base/ops/add4/README.md +++ /dev/null @@ -1,221 +0,0 @@ - - -# add4 - -> Compute the sum of four double-precision floating-point numbers. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var add4 = require( '@stdlib/math/base/ops/add4' ); -``` - -#### add4( x, y, z, w ) - -Computes the sum of four double-precision floating-point numbers. - -```javascript -var v = add4( -1.0, 5.0, 2.0, -3.0 ); -// returns 3.0 - -v = add4( 2.0, 5.0, 2.0, -3.0 ); -// returns 6.0 - -v = add4( 0.0, 5.0, 2.0, -3.0 ); -// returns 4.0 - -v = add4( -0.0, 0.0, 0.0, -0.0 ); -// returns 0.0 - -v = add4( NaN, NaN, NaN, NaN ); -// returns NaN -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var rand = require( '@stdlib/random/base/discrete-uniform' ).factory; -var filledBy = require( '@stdlib/array/base/filled-by' ); -var add4 = require( '@stdlib/math/base/ops/add4' ); - -var x = filledBy( 100, rand( -50, 50 ) ); -var y = filledBy( x.length, rand( -50, 50 ) ); -var z = filledBy( x.length, rand( -50, 50 ) ); -var w = filledBy( x.length, rand( -50, 50 ) ); - -var i; -for ( i = 0; i < x.length; i++ ) { - console.log( '%d + %d + %d + %d = %d', x[i], y[i], z[i], w[i], add4( x[i], y[i], z[i], w[i] ) ); -} -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/math/base/ops/add4.h" -``` - -#### stdlib_base_add4( x, y, z, w ) - -Computes the sum of four double-precision floating-point numbers. - -```c -double out = stdlib_base_add4( -5.0, 2.0, 4.0, 3.0 ); -// returns 4.0 -``` - -The function accepts the following arguments: - -- **x**: `[in] double` first input value. -- **y**: `[in] double` second input value. -- **z**: `[in] double` third input value. -- **w**: `[in] double` fourth input value. - -```c -double stdlib_base_add4( const double x, const double y, const double z, const double w ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/math/base/ops/add4.h" -#include - -int main( void ) { - const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 }; - const double y[] = { 3.14, -3.14, -0.0, 0.0/0.0 }; - const double z[] = { 2.0, -3.0, -0.0, 0.0/0.0 }; - const double w[] = { 2.0, -3.0, -0.0, 0.0/0.0 }; - - double out; - int i; - for ( i = 0; i < 4; i++ ) { - out = stdlib_base_add4( x[ i ], y[ i ], z[ i ], w[ i ] ); - printf( "%lf + %lf + %lf + %lf = %lf\n", x[ i ], y[ i ], z[ i ], w[ i ], out ); - } -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/base/ops/add4/benchmark/benchmark.js b/base/ops/add4/benchmark/benchmark.js deleted file mode 100644 index c3b1138cd..000000000 --- a/base/ops/add4/benchmark/benchmark.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var isnan = require( './../../../../base/assert/is-nan' ); -var pkg = require( './../package.json' ).name; -var add4 = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = add4( x, 5.0, i, x ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::inline', function benchmark( b ) { - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = x + 5.0 + i + x; - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/add4/benchmark/benchmark.native.js b/base/ops/add4/benchmark/benchmark.native.js deleted file mode 100644 index ea870c689..000000000 --- a/base/ops/add4/benchmark/benchmark.native.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var isnan = require( './../../../../base/assert/is-nan' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var add4 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add4 instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = add4( x, 5.0, i, x ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/add4/benchmark/c/Makefile b/base/ops/add4/benchmark/c/Makefile deleted file mode 100644 index e42401865..000000000 --- a/base/ops/add4/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/add4/benchmark/c/benchmark.c b/base/ops/add4/benchmark/c/benchmark.c deleted file mode 100644 index f1f70ba96..000000000 --- a/base/ops/add4/benchmark/c/benchmark.c +++ /dev/null @@ -1,141 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#define NAME "add4" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Adds four numbers. -* -* @return sum -*/ -double add4( const double x, const double y, const double z, const double w ) { - return x + y + z + w; -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double x; - double y; - double t; - int i; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = add4( x, 5.0, 2.0, x ); - if ( y != y ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( y != y ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/add4/benchmark/c/native/Makefile b/base/ops/add4/benchmark/c/native/Makefile deleted file mode 100644 index 3cbfe3fef..000000000 --- a/base/ops/add4/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/add4/benchmark/c/native/benchmark.c b/base/ops/add4/benchmark/c/native/benchmark.c deleted file mode 100644 index 8e617635f..000000000 --- a/base/ops/add4/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/math/base/ops/add4.h" -#include -#include -#include -#include -#include - -#define NAME "add4" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static double rand_double( void ) { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -static double benchmark( void ) { - double elapsed; - double x; - double y; - double t; - int i; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = stdlib_base_add4( x, 5.0, 2.0, x ); - if ( y != y ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( y != y ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/add4/binding.gyp b/base/ops/add4/binding.gyp deleted file mode 100644 index f2b466aef..000000000 --- a/base/ops/add4/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/base/ops/add4/docs/repl.txt b/base/ops/add4/docs/repl.txt deleted file mode 100644 index 2d42a7da3..000000000 --- a/base/ops/add4/docs/repl.txt +++ /dev/null @@ -1,39 +0,0 @@ - -{{alias}}( x, y, z, w ) - Computes the sum of four double-precision floating-point numbers. - - Parameters - ---------- - x: number - First input value. - - y: number - Second input value. - - z: number - Third input value. - - w: number - Fourth input value. - - Returns - ------- - out: number - Sum. - - Examples - -------- - > var v = {{alias}}( -1.0, 5.0, 2.0, -3.0 ) - 3.0 - > v = {{alias}}( 2.0, 5.0, 2.0, -3.0 ) - 6.0 - > v = {{alias}}( 0.0, 5.0, 2.0, -3.0 ) - 4.0 - > v = {{alias}}( -0.0, 0.0, -0.0, -0.0 ) - 0.0 - > v = {{alias}}( NaN, NaN, NaN, NaN ) - NaN - - See Also - -------- - diff --git a/base/ops/add4/docs/types/index.d.ts b/base/ops/add4/docs/types/index.d.ts deleted file mode 100644 index bc031b9d4..000000000 --- a/base/ops/add4/docs/types/index.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Computes the sum of four double-precision floating-point numbers. -* -* @param x - first input value -* @param y - second input value -* @param z - third input value -* @param w - fourth input value -* @returns sum -* -* @example -* var v = add4( -1.0, 5.0, 2.0, -3.0 ); -* // returns 3.0 -* -* @example -* var v = add4( 2.0, 5.0, 2.0, -3.0 ); -* // returns 6.0 -* -* @example -* var v = add4( 0.0, 5.0, 2.0, -3.0 ); -* // returns 4.0 -* -* @example -* var v = add4( -0.0, 0.0, -0.0, -0.0 ); -* // returns 0.0 -* -* @example -* var v = add4( NaN, NaN, NaN, NaN ); -* // returns NaN -*/ -declare function add4( x: number, y: number, z: number, w: number ): number; - - -// EXPORTS // - -export = add4; diff --git a/base/ops/add4/docs/types/test.ts b/base/ops/add4/docs/types/test.ts deleted file mode 100644 index 67d73ee5d..000000000 --- a/base/ops/add4/docs/types/test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import add4 = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - add4( 8.0, 8.0, 8.0, 8.0 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a first argument which is not a number... -{ - add4( true, 5.0, 2.0, -3.0 ); // $ExpectError - add4( false, 5.0, 2.0, -3.0 ); // $ExpectError - add4( null, 5.0, 2.0, -3.0 ); // $ExpectError - add4( undefined, 5.0, 2.0, -3.0 ); // $ExpectError - add4( '5', 5.0, 2.0, -3.0 ); // $ExpectError - add4( [], 5.0, 2.0, -3.0 ); // $ExpectError - add4( {}, 5.0, 2.0, -3.0 ); // $ExpectError - add4( ( x: number ): number => x, 5.0, 2.0, -3.0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a number... -{ - add4( 5.0, true, 2.0, -3.0 ); // $ExpectError - add4( 5.0, false, 2.0, -3.0 ); // $ExpectError - add4( 5.0, null, 2.0, -3.0 ); // $ExpectError - add4( 5.0, undefined, 2.0, -3.0 ); // $ExpectError - add4( 5.0, '5', 2.0, -3.0 ); // $ExpectError - add4( 5.0, [], 2.0, -3.0 ); // $ExpectError - add4( 5.0, {}, 2.0, -3.0 ); // $ExpectError - add4( 5.0, ( x: number ): number => x, 2.0, -3.0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a number... -{ - add4( 5.0, 5.0, true, -3.0 ); // $ExpectError - add4( 5.0, 5.0, false, -3.0 ); // $ExpectError - add4( 5.0, 5.0, null, -3.0 ); // $ExpectError - add4( 5.0, 5.0, undefined, -3.0 ); // $ExpectError - add4( 5.0, 5.0, '5', -3.0 ); // $ExpectError - add4( 5.0, 5.0, [], -3.0 ); // $ExpectError - add4( 5.0, 5.0, {}, -3.0 ); // $ExpectError - add4( 5.0, 5.0, ( x: number ): number => x, -3.0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fourth argument which is not a number... -{ - add4( 5.0, 5.0, 5.0, true ); // $ExpectError - add4( 5.0, 5.0, 5.0, false ); // $ExpectError - add4( 5.0, 5.0, 5.0, null ); // $ExpectError - add4( 5.0, 5.0, 5.0, undefined ); // $ExpectError - add4( 5.0, 5.0, 5.0, '5' ); // $ExpectError - add4( 5.0, 5.0, 5.0, [] ); // $ExpectError - add4( 5.0, 5.0, 5.0, {} ); // $ExpectError - add4( 5.0, 5.0, 5.0, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - add4(); // $ExpectError - add4( 5.0 ); // $ExpectError - add4( 5.0, 5.0 ); // $ExpectError - add4( 5.0, 5.0, 5.0 ); // $ExpectError - add4( 5.0, 5.0, 5.0, 5.0, 5.0 ); // $ExpectError -} diff --git a/base/ops/add4/examples/c/Makefile b/base/ops/add4/examples/c/Makefile deleted file mode 100644 index f0ae66fec..000000000 --- a/base/ops/add4/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/add4/examples/c/example.c b/base/ops/add4/examples/c/example.c deleted file mode 100644 index 9bbfc00ba..000000000 --- a/base/ops/add4/examples/c/example.c +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/math/base/ops/add4.h" -#include - -int main( void ) { - const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 }; - const double y[] = { 3.14, -3.14, -0.0, 0.0/0.0 }; - const double z[] = { 2.0, -3.0, -0.0, 0.0/0.0 }; - const double w[] = { 2.0, -3.0, -0.0, 0.0/0.0 }; - - double out; - int i; - for ( i = 0; i < 4; i++ ) { - out = stdlib_base_add4( x[ i ], y[ i ], z[ i ], w[ i ] ); - printf( "%lf + %lf + %lf + %lf = %lf\n", x[ i ], y[ i ], z[ i ], w[ i ], out ); - } -} diff --git a/base/ops/add4/examples/index.js b/base/ops/add4/examples/index.js deleted file mode 100644 index d547616f3..000000000 --- a/base/ops/add4/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var rand = require( '@stdlib/random/base/discrete-uniform' ).factory; -var filledBy = require( '@stdlib/array/base/filled-by' ); -var add4 = require( './../lib' ); - -var x = filledBy( 100, rand( -50, 50 ) ); -var y = filledBy( x.length, rand( -50, 50 ) ); -var z = filledBy( x.length, rand( -50, 50 ) ); -var w = filledBy( x.length, rand( -50, 50 ) ); - -var i; -for ( i = 0; i < x.length; i++ ) { - console.log( '%d + %d + %d + %d = %d', x[i], y[i], z[i], w[i], add4( x[i], y[i], z[i], w[i] ) ); -} diff --git a/base/ops/add4/include.gypi b/base/ops/add4/include.gypi deleted file mode 100644 index 78db9faf8..000000000 --- a/base/ops/add4/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - '=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "sum", - "add", - "addition", - "summation", - "number", - "double", - "double-precision" - ], - "__stdlib__": {} -} diff --git a/base/ops/add4/src/Makefile b/base/ops/add4/src/Makefile deleted file mode 100644 index 904c7dc4b..000000000 --- a/base/ops/add4/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2023 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/base/ops/add4/src/addon.c b/base/ops/add4/src/addon.c deleted file mode 100644 index 4c43318fd..000000000 --- a/base/ops/add4/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/math/base/ops/add4.h" -#include "stdlib/math/base/napi/quaternary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_DDDD_D( stdlib_base_add4 ) diff --git a/base/ops/add4/src/main.c b/base/ops/add4/src/main.c deleted file mode 100644 index 2ddd855fa..000000000 --- a/base/ops/add4/src/main.c +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/math/base/ops/add4.h" - -/** -* Computes the sum of four double-precision floating-point numbers. -* -* @param x first number -* @param y second number -* @param z third number -* @param w fourth number -* @return sum -* -* @example -* double z = stdlib_base_add4( -5.0, 3.0, 4.0, 2.0 ); -* // returns 4.0 -*/ -double stdlib_base_add4( const double x, const double y, const double z, const double w ) { - return x + y + z + w; -} diff --git a/base/ops/add4/test/test.js b/base/ops/add4/test/test.js deleted file mode 100644 index b75f3e749..000000000 --- a/base/ops/add4/test/test.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isNegativeZero = require( './../../../../base/assert/is-negative-zero' ); -var isPositiveZero = require( './../../../../base/assert/is-positive-zero' ); -var isnan = require( './../../../../base/assert/is-nan' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var add4 = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add4, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds four numbers', function test( t ) { - t.strictEqual( add4( -2.0, 4.0, 3.0, 5.0 ), 10.0, 'returns expected value' ); - t.strictEqual( add4( 3.0, 0.0, 2.0, 4.0 ), 9.0, 'returns expected value' ); - t.strictEqual( add4( 0.0, -0.0, -0.0, -0.0 ), 0.0, 'returns expected value' ); - t.strictEqual( add4( -PI, -PI, -PI, -PI ), -4.0*PI, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles negative zeros', function test( t ) { - t.strictEqual( isNegativeZero( add4( -0.0, -0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( -0.0, 0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, -0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, 0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, -0.0, 0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( -0.0, 0.0, 0.0, -0.0 ) ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles infinities', function test( t ) { - t.strictEqual( add4( PINF, 5.0, 2.0, 1.0 ), PINF, 'returns expected value' ); - t.strictEqual( add4( 5.0, PINF, 2.0, 1.0 ), PINF, 'returns expected value' ); - t.strictEqual( add4( PINF, PINF, PINF, PINF ), PINF, 'returns expected value' ); - - t.strictEqual( add4( NINF, 5.0, 2.0, 1.0 ), NINF, 'returns expected value' ); - t.strictEqual( add4( 5.0, NINF, 2.0, 1.0 ), NINF, 'returns expected value' ); - t.strictEqual( add4( NINF, NINF, NINF, NINF ), NINF, 'returns expected value' ); - - t.strictEqual( isnan( add4( NINF, PINF, PINF, NINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, NINF, PINF, NINF ) ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if provided a `NaN`, the function returns `NaN`', function test( t ) { - t.strictEqual( isnan( add4( NaN, 5.0, 2.0, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NaN, PINF, PINF, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NaN, NINF, NINF, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( 5.0, NaN, 2.0, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, NaN, PINF, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NINF, NaN, NINF, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( 5.0, 2.0, NaN, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, PINF, NaN, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NINF, NINF, NaN, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( NaN, NaN, NaN, NaN ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/add4/test/test.native.js b/base/ops/add4/test/test.native.js deleted file mode 100644 index fac8732d5..000000000 --- a/base/ops/add4/test/test.native.js +++ /dev/null @@ -1,99 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isNegativeZero = require( './../../../../base/assert/is-negative-zero' ); -var isPositiveZero = require( './../../../../base/assert/is-positive-zero' ); -var isnan = require( './../../../../base/assert/is-nan' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var add4 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( add4 instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof add4, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function adds four numbers', opts, function test( t ) { - t.strictEqual( add4( -2.0, 4.0, 3.0, 5.0 ), 10.0, 'returns expected value' ); - t.strictEqual( add4( 3.0, 0.0, 2.0, 4.0 ), 9.0, 'returns expected value' ); - t.strictEqual( add4( 0.0, -0.0, -0.0, -0.0 ), 0.0, 'returns expected value' ); - t.strictEqual( add4( -PI, -PI, -PI, -PI ), -4.0*PI, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles negative zeros', opts, function test( t ) { - t.strictEqual( isNegativeZero( add4( -0.0, -0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( -0.0, 0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, -0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, 0.0, -0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( 0.0, -0.0, 0.0, -0.0 ) ), true, 'returns expected value' ); - t.strictEqual( isPositiveZero( add4( -0.0, 0.0, 0.0, -0.0 ) ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles infinities', opts, function test( t ) { - t.strictEqual( add4( PINF, 5.0, 2.0, 1.0 ), PINF, 'returns expected value' ); - t.strictEqual( add4( 5.0, PINF, 2.0, 1.0 ), PINF, 'returns expected value' ); - t.strictEqual( add4( PINF, PINF, PINF, PINF ), PINF, 'returns expected value' ); - - t.strictEqual( add4( NINF, 5.0, 2.0, 1.0 ), NINF, 'returns expected value' ); - t.strictEqual( add4( 5.0, NINF, 2.0, 1.0 ), NINF, 'returns expected value' ); - t.strictEqual( add4( NINF, NINF, NINF, NINF ), NINF, 'returns expected value' ); - - t.strictEqual( isnan( add4( NINF, PINF, PINF, NINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, NINF, PINF, NINF ) ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if provided a `NaN`, the function returns `NaN`', opts, function test( t ) { - t.strictEqual( isnan( add4( NaN, 5.0, 2.0, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NaN, PINF, PINF, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NaN, NINF, NINF, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( 5.0, NaN, 2.0, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, NaN, PINF, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NINF, NaN, NINF, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( 5.0, 2.0, NaN, 1.0 ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( PINF, PINF, NaN, PINF ) ), true, 'returns expected value' ); - t.strictEqual( isnan( add4( NINF, NINF, NaN, NINF ) ), true, 'returns expected value' ); - - t.strictEqual( isnan( add4( NaN, NaN, NaN, NaN ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/docs/types/index.d.ts b/base/ops/docs/types/index.d.ts index 73e8cf5f5..0f200e9b9 100644 --- a/base/ops/docs/types/index.d.ts +++ b/base/ops/docs/types/index.d.ts @@ -26,7 +26,7 @@ import cadd = require( '@stdlib/complex/float64/base/add' ); import cmul = require( '@stdlib/complex/float64/base/mul' ); import add = require( '@stdlib/number/float64/base/add' ); import add3 = require( './../../../../base/ops/add3' ); -import add4 = require( './../../../../base/ops/add4' ); +import add4 = require( '@stdlib/number/float64/base/add4' ); import add5 = require( './../../../../base/ops/add5' ); import addf = require( './../../../../base/ops/addf' ); import cdiv = require( './../../../../base/ops/cdiv' ); diff --git a/base/ops/lib/index.js b/base/ops/lib/index.js index ec291424e..2a4e1592a 100644 --- a/base/ops/lib/index.js +++ b/base/ops/lib/index.js @@ -81,15 +81,6 @@ setReadOnly( ns, 'cmul', require( '@stdlib/complex/float64/base/mul' ) ); */ setReadOnly( ns, 'add3', require( './../../../base/ops/add3' ) ); -/** -* @name add4 -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/math/base/ops/add4} -*/ -setReadOnly( ns, 'add4', require( './../../../base/ops/add4' ) ); - /** * @name add5 * @memberof ns