From 21e3c87c229d387eea0a8e977afca6a5978a07f3 Mon Sep 17 00:00:00 2001 From: Sahil Goyal Date: Sat, 22 Mar 2025 10:16:08 +0000 Subject: [PATCH 01/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. Closes: #6163 --- .../math/base/special/minmaxabsf/README.md | 271 ++++++++++++++++++ .../special/minmaxabsf/benchmark/benchmark.js | 0 .../minmaxabsf/benchmark/c/native/Makefile | 0 .../minmaxabsf/benchmark/c/native/benchmark.c | 0 .../minmaxabsf/benchmark/julia/REQUIRE | 0 .../minmaxabsf/benchmark/julia/benchmark.jl | 0 .../math/base/special/minmaxabsf/binding.gyp | 170 +++++++++++ .../base/special/minmaxabsf/docs/repl.txt | 0 .../special/minmaxabsf/docs/types/index.d.ts | 0 .../special/minmaxabsf/docs/types/test.ts | 0 .../special/minmaxabsf/examples/c/Makefile | 0 .../special/minmaxabsf/examples/c/example.c | 0 .../base/special/minmaxabsf/examples/index.js | 34 +++ .../math/base/special/minmaxabsf/include.gypi | 0 .../stdlib/math/base/special/minmaxabsf.h | 0 .../base/special/minmaxabsf/lib/assign.js | 0 .../math/base/special/minmaxabsf/lib/index.js | 0 .../math/base/special/minmaxabsf/lib/main.js | 0 .../base/special/minmaxabsf/lib/native.js | 0 .../base/special/minmaxabsf/manifest.json | 0 .../math/base/special/minmaxabsf/package.json | 73 +++++ .../math/base/special/minmaxabsf/src/Makefile | 70 +++++ .../math/base/special/minmaxabsf/src/addon.c | 0 .../math/base/special/minmaxabsf/src/main.c | 0 .../special/minmaxabsf/test/test.assign.js | 0 .../math/base/special/minmaxabsf/test/test.js | 37 +++ .../base/special/minmaxabsf/test/test.main.js | 0 .../special/minmaxabsf/test/test.native.js | 0 28 files changed, 655 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js create mode 100644 lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md new file mode 100644 index 000000000000..7fe46782970d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -0,0 +1,271 @@ + + +# minmaxabsf + +> Return the minimum and maximum absolute single-precision floating-point numbers. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var minmaxabsf = require( '@stdlib/math/base/special/minmaxabsf' ); +``` + +#### minmaxabsf( x,y ) + +Returns the minimum and maximum absolute single-precision floating-point values in a single pass. + +```javascript +var v = minmaxabsf( 4.2, 3.14 ); +// returns [ 3.14, 4.2 ] + +v = minmaxabsf( +0.0, -0.0 ); +// returns [ 0.0, 0.0 ] +``` + +If any argument is `NaN`, the function returns `Nan` for both the minimum value and the maximum value. + +```javascript +var v = minmaxabs( 4.2, NaN ); +// returns [ NaN, NaN ] + +v = minmaxabs( NaN, 3.14 ); +// returns [ NaN, NaN ] +``` + +#### minmaxabsf.assign( x, y, out, stride, offset ) + +Returns the minimum and maximum absolute single-precision values in a single pass and assigns the results to a provided output array. + +```javascript +var Float64Array = require( '@stdlib/array/float32' ); + +var out = new Float32Array( 2 ); + +var v = minmaxabsf.assign( 5.0, -1.0, out, 1, 0 ); +// returns [ 1.0, 5.0 ] + +var bool = ( v === out ); +// returns true +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var randu = require( '@stdlib/random/base/randu' ); +var minmaxabs = require( '@stdlib/math/base/special/minmaxabsf' ); + +var x; +var y; +var v; +var i; + +for ( i = 0; i < 100; i++ ) { + x = ( randu()*100.0 ) - 50.0; + y = ( randu()*100.0 ) - 50.0; + v = minmaxabsf( x, y ); + console.log( 'minmaxabsf(%d,%d) = [%d, %d]', x, y, v[0], v[1] ); +} +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/minmaxabsf.h" +``` + +#### stdlib_base_minmaxabsf( x, y, min, max ) + +Returns the minimum and maximum absolute single-precision floating-point values in a single pass. + +```c +float min; +float max; +float out = stdlib_base_minmaxabsf( -4.2f, 3.14f, &min, &max ); +// returns [ 3.14, 4.2 ] + +out = stdlib_base_minmaxabsf( 0.0f, -0.0f, &min, &max ); +// returns [ 0.0, 0.0 ] +``` + +The function accepts the following arguments: +- **x**: `[in] float` input value. +- **y**: `[in] float` input value. +- **min**: `[in] *float` output min. +- **max**: `[in] *float` output max. + +```c +void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/minmaxabsf.h" +#include +#include + +int main(void) { + srand(time(NULL)); // Seed random number generator + + float x1[10], x2[10]; + float min, max; + int i; + + // Generate random floating-point values between -1.0 and 1.0 + for (i = 0; i < 10; i++) { + x1[i] = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; // Random float in [-1,1] + x2[i] = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; // Random float in [-1,1] + + // Introduce NaN values randomly + if (rand() % 10 == 0) x1[i] = NAN; + if (rand() % 10 == 0) x2[i] = NAN; + } + + // Compute min and max values + for (i = 0; i < 10; i++) { + stdlib_base_minmaxf(x1[i], x2[i], &min, &max); + printf("x1[%d]: %f, x2[%d]: %f, minmaxf(x1[%d], x2[%d]): (%f, %f)\n", + i, x1[i], i, x2[i], i, i, min, max); + } + + return 0; +} +``` + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp new file mode 100644 index 000000000000..ec3992233442 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2024 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/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js new file mode 100644 index 000000000000..b3cfaa2c8ea5 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js @@ -0,0 +1,34 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 randu = require( '@stdlib/random/base/randu' ); +var minmaxabsf = require( './../lib' ); + +var x; +var y; +var v; +var i; + +for ( i = 0; i < 100; i++ ) { + x = ( randu()*100.0 ) - 50.0; + y = ( randu()*100.0 ) - 50.0; + v = minmaxabsf( x, y ); + console.log( 'minmaxabs(%d,%d) = [%d, %d]', x, y, v[0], v[1] ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json new file mode 100644 index 000000000000..921291c34214 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/math/base/special/minmaxabsf", + "version": "0.0.0", + "description": "Return the minimum and maximum absolute single-precision floating-point numbers.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "math.min", + "math.max", + "minimum", + "maximum", + "extremum", + "min", + "max", + "smallest", + "largest", + "extrema", + "absolute", + "value", + "abs", + "magnitude", + "math.abs" + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 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/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js new file mode 100644 index 000000000000..836fc689363d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2022 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var PINF = require( '@stdlib/constants/float32/pinf' ); +var minmaxabsf = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof minabsf, 'function', 'main export is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js new file mode 100644 index 000000000000..e69de29bb2d1 From 7ab15ee4d8fc469d07e27bd46b54bf7bcfa9f0a1 Mon Sep 17 00:00:00 2001 From: Sahil Goyal Date: Sat, 22 Mar 2025 11:03:56 +0000 Subject: [PATCH 02/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. Closes: #6163 --- etc/npm/deps.txt | 2 +- .../math/base/special/minmaxabsf/README.md | 10 +- .../special/minmaxabsf/benchmark/benchmark.js | 81 +++++ .../minmaxabsf/benchmark/c/native/Makefile | 146 +++++++++ .../minmaxabsf/benchmark/c/native/benchmark.c | 139 ++++++++ .../minmaxabsf/benchmark/julia/REQUIRE | 2 + .../minmaxabsf/benchmark/julia/benchmark.jl | 144 +++++++++ .../base/special/minmaxabsf/docs/repl.txt | 68 ++++ .../special/minmaxabsf/docs/types/index.d.ts | 93 ++++++ .../special/minmaxabsf/docs/types/test.ts | 129 ++++++++ .../special/minmaxabsf/examples/c/Makefile | 146 +++++++++ .../special/minmaxabsf/examples/c/example.c | 36 +++ .../math/base/special/minmaxabsf/include.gypi | 53 ++++ .../stdlib/math/base/special/minmaxabsf.h | 38 +++ .../base/special/minmaxabsf/lib/assign.js | 87 +++++ .../math/base/special/minmaxabsf/lib/index.js | 59 ++++ .../math/base/special/minmaxabsf/lib/main.js | 59 ++++ .../base/special/minmaxabsf/lib/native.js | 60 ++++ .../base/special/minmaxabsf/manifest.json | 98 ++++++ .../math/base/special/minmaxabsf/src/addon.c | 23 ++ .../math/base/special/minmaxabsf/src/main.c | 61 ++++ .../special/minmaxabsf/test/test.assign.js | 204 ++++++++++++ .../math/base/special/minmaxabsf/test/test.js | 71 ++++- .../base/special/minmaxabsf/test/test.main.js | 120 +++++++ .../special/minmaxabsf/test/test.native.js | 129 ++++++++ package.json | 297 +----------------- 26 files changed, 2052 insertions(+), 303 deletions(-) diff --git a/etc/npm/deps.txt b/etc/npm/deps.txt index ce3c5bbaed3f..8b137891791f 100644 --- a/etc/npm/deps.txt +++ b/etc/npm/deps.txt @@ -1 +1 @@ -acorn@"^8.1.0" acorn-loose@"^8.0.2" acorn-walk@"^8.0.2" d3-format@"^1.0.0" d3-scale@"^1.0.0" d3-shape@"^1.0.0" d3-time-format@"^2.0.0" debug@"^2.6.9" glob@"^7.0.5" minimist@"^1.2.0" readable-stream@"^2.1.4" resolve@"^1.1.7" vdom-to-html@"^2.3.0" virtual-dom@"^2.1.1" 0x@"^4.10.2" @cspell/eslint-plugin@"^8.8.0" @commitlint/cli@"^17.4.4" @commitlint/cz-commitlint@"^17.4.4" @conventional-commits/parser@"^0.4.1" @kaciras/deasync@"^1.0.1" @types/node@"^13.9.0" @typescript-eslint/parser@"^6.9.1" @typescript-eslint/eslint-plugin@"^6.9.1" ajv@"^5.2.2" browser-pack-flat@"^3.0.0" browserify@"^17.0.0" bundle-collapser@"^1.3.0" c8@"^7.12.0" chai@"^3.5.0" cheerio@"^1.0.0-rc.12" commitizen@"^4.3.0" common-shakeify@"^0.6.0" conventional-changelog-conventionalcommits@"^5.0.0" doctrine@"^3.0.0" editorconfig-checker@"^6.0.0" envify@"^4.0.0" eslint@"^8.57.0" eslint-plugin-node@"^11.1.0" eslint-plugin-expect-type@"^0.2.3" eslint-plugin-import@"^2.29.0" eslint-plugin-jsdoc@"^46.8.2" exorcist@"^2.0.0" factor-bundle@"^2.5.0" gh-pages@"git+https://github.com/Planeshifter/gh-pages.git#main" inquirer@"^8.0.0" jscodeshift@"^0.15.0" jsdoc@"^3.4.0" lunr@"^2.3.9" mathjax-node@"^2.0.1" mathjax-node-sre@"^3.0.0" mkdirp@"^0.5.1" mustache@"^4.0.0" parse-link-header@"^1.0.1" plato@"^1.5.0" process@"^0.11.10" proxyquire@"^2.0.0" proxyquire-universal@"^2.0.0" proxyquireify@"^3.1.1" read-installed@"^4.0.3" rehype@"^9.0.0" rehype-highlight@"^3.0.0" remark@"^11.0.1" remark-cli@"^7.0.0" remark-frontmatter@"^1.2.0" remark-html@"^10.0.0" remark-lint@"^6.0.0" remark-lint-blockquote-indentation@"^1.0.0" remark-lint-checkbox-character-style@"^1.0.0" remark-lint-checkbox-content-indent@"^1.0.0" remark-lint-code-block-style@"^1.0.0" remark-lint-definition-case@"^1.0.0" remark-lint-definition-spacing@"^1.0.0" remark-lint-emphasis-marker@"^1.0.0" remark-lint-fenced-code-flag@"^1.0.0" remark-lint-fenced-code-marker@"^1.0.0" remark-lint-file-extension@"^1.0.0" remark-lint-final-definition@"^1.0.0" remark-lint-final-newline@"^1.0.0" remark-lint-first-heading-level@"^1.1.0" remark-lint-hard-break-spaces@"^1.0.1" remark-lint-heading-increment@"^1.0.0" remark-lint-heading-style@"^1.0.0" remark-lint-linebreak-style@"^1.0.0" remark-lint-link-title-style@"^1.0.0" remark-lint-list-item-bullet-indent@"^1.0.0" remark-lint-list-item-content-indent@"^1.0.0" remark-lint-list-item-indent@"^1.0.0" remark-lint-list-item-spacing@"^1.1.0" remark-lint-maximum-heading-length@"^1.0.0" remark-lint-maximum-line-length@"^1.0.0" remark-lint-no-auto-link-without-protocol@"^1.0.0" remark-lint-no-blockquote-without-marker@"^2.0.0" remark-lint-no-consecutive-blank-lines@"^1.0.0" remark-lint-no-duplicate-definitions@"^1.0.0" remark-lint-no-duplicate-headings@"^1.0.0" remark-lint-no-duplicate-headings-in-section@"^1.0.0" remark-lint-no-emphasis-as-heading@"^1.0.0" remark-lint-no-empty-url@"^1.0.1" remark-lint-no-file-name-articles@"^1.0.0" remark-lint-no-file-name-consecutive-dashes@"^1.0.0" remark-lint-no-file-name-irregular-characters@"^1.0.0" remark-lint-no-file-name-mixed-case@"^1.0.0" remark-lint-no-file-name-outer-dashes@"^1.0.1" remark-lint-no-heading-content-indent@"^1.0.0" remark-lint-no-heading-indent@"^1.0.0" remark-lint-no-heading-like-paragraph@"^1.0.0" remark-lint-no-heading-punctuation@"^1.0.0" remark-lint-no-html@"^1.0.0" remark-lint-no-inline-padding@"^1.0.0" remark-lint-no-literal-urls@"^1.0.0" remark-lint-no-missing-blank-lines@"^1.0.0" remark-lint-no-multiple-toplevel-headings@"^1.0.0" remark-lint-no-paragraph-content-indent@"^1.0.1" remark-lint-no-reference-like-url@"^1.0.0" remark-lint-no-shell-dollars@"^1.0.0" remark-lint-no-shortcut-reference-image@"^1.0.0" remark-lint-no-shortcut-reference-link@"^1.0.1" remark-lint-no-table-indentation@"^1.0.0" remark-lint-no-tabs@"^1.0.0" remark-lint-no-trailing-spaces@"^3.0.2" remark-lint-no-undefined-references@"^1.0.0" remark-lint-no-unused-definitions@"^1.0.0" remark-lint-ordered-list-marker-style@"^1.0.0" remark-lint-ordered-list-marker-value@"^1.0.0" remark-lint-rule-style@"^1.0.0" remark-lint-strong-marker@"^1.0.0" remark-lint-table-cell-padding@"^1.0.0" remark-lint-table-pipe-alignment@"^1.0.0" remark-lint-table-pipes@"^1.0.0" remark-lint-unordered-list-marker-style@"^1.0.0" remark-slug@"^5.0.0" remark-unlink@"^2.0.0" remark-validate-links@"^9.0.1" remark-vdom@"^8.0.0" semver@"^6.0.0" source-map-explorer@"^2.5.3" spdx-license-ids@"^3.0.0" tap-min@"git+https://github.com/Planeshifter/tap-min.git" tap-spec@"5.x.x" tap-summary@"^4.0.0" tap-xunit@"^2.2.0" tape@"git+https://github.com/kgryte/tape.git#fix/globby" to-vfile@"^6.0.0" typedoc@"git+https://github.com/kgryte/typedoc.git#0.16.11-patch" typescript@"4.3.5" uglify-js@"^3.17.4" uglifyify@"^5.0.0" unified-lint-rule@"^1.0.1" unist-util-visit@"^2.0.0" unist-util-visit-parents@"^3.1.1" yaml@"^1.0.0" node-gyp@"^9.3.1" + diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index 7fe46782970d..673cf7a5881a 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -152,11 +152,11 @@ Returns the minimum and maximum absolute single-precision floating-point values ```c float min; float max; -float out = stdlib_base_minmaxabsf( -4.2f, 3.14f, &min, &max ); -// returns [ 3.14, 4.2 ] +stdlib_base_minmaxabsf( -4.2f, 3.14f, &min, &max ); +// [ 3.14, 4.2 ] -out = stdlib_base_minmaxabsf( 0.0f, -0.0f, &min, &max ); -// returns [ 0.0, 0.0 ] +stdlib_base_minmaxabsf( 0.0f, -0.0f, &min, &max ); +// [ 0.0, 0.0 ] ``` The function accepts the following arguments: @@ -211,7 +211,7 @@ int main(void) { // Compute min and max values for (i = 0; i < 10; i++) { - stdlib_base_minmaxf(x1[i], x2[i], &min, &max); + stdlib_base_minmaxabsf(x1[i], x2[i], &min, &max); printf("x1[%d]: %f, x2[%d]: %f, minmaxf(x1[%d], x2[%d]): (%f, %f)\n", i, x1[i], i, x2[i], i, i, min, max); } diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js index e69de29bb2d1..ca53576ec6a4 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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/randn' ); +var isFloat32Array = require( '@stdlib/assert/is-float32array' ); +var isArray = require( '@stdlib/assert/is-array' ); +var minf = require( '@stdlib/math/base/special/minf' ); +var maxf = require( '@stdlib/math/base/special/maxf' ); +var float32Array = require( '@stdlib/array/float32' ); +var pkg = require( './../package.json' ).name; +var minmaxabsf = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*1000.0 ) - 500.0; + y = ( randu()*1000.0 ) - 500.0; + z = minmaxabsf( x, y ); + if ( z.length !== 2 ) { + b.fail( 'should have expected length' ); + } + } + b.toc(); + if ( !isFloat32Array( z ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':assign', function benchmark( b ) { + var x; + var y; + var z; + var i; + + z = new float32Array( 2 ); + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*1000.0 ) - 500.0; + y = ( randu()*1000.0 ) - 500.0; + z = minmaxabsf.assign( x, y, z, 1, 0 ); + if ( z.length !== 2 ) { + b.fail( 'should have expected length' ); + } + } + b.toc(); + if ( !isFloat32Array( z ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile index e69de29bb2d1..f69e9da2b4d3 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 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/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c index e69de29bb2d1..9013b3afab88 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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/special/minmaxabsf.h" +#include +#include +#include +#include +#include + +#define NAME "minmaxabsf" +#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 t; + float x[ 100 ]; + float y[ 100 ]; + float min; + float max; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0f * rand_double() ) - 500.0f; + y[ i ] = ( 1000.0f * rand_double() ) - 500.0f; + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + stdlib_base_minmaxabsf( x[ i % 100 ], y[ i % 100 ], &min, &max ); + if ( min != min || max != max ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( min != min || max != max ) { + 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/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE index e69de29bb2d1..98645e192e41 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/REQUIRE @@ -0,0 +1,2 @@ +julia 1.5 +BenchmarkTools 0.5.0 diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl index e69de29bb2d1..b78839e3f6fb 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl @@ -0,0 +1,144 @@ +#!/usr/bin/env julia +# +# @license Apache-2.0 +# +# Copyright (c) 2018 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 BenchmarkTools +using Printf + +# Benchmark variables: +name = "minmaxabsf"; +repeats = 3; + +""" + print_version() + +Prints the TAP version. + +# Examples + +``` julia +julia> print_version() +``` +""" +function print_version() + @printf( "TAP version 13\n" ); +end + +""" + print_summary( total, passing ) + +Print the benchmark summary. + +# Arguments + +* `total`: total number of tests +* `passing`: number of passing tests + +# Examples + +``` julia +julia> print_summary( 3, 3 ) +``` +""" +function print_summary( total, 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" ); +end + +""" + print_results( iterations, elapsed ) + +Print benchmark results. + +# Arguments + +* `iterations`: number of iterations +* `elapsed`: elapsed time (in seconds) + +# Examples + +``` julia +julia> print_results( 1000000, 0.131009101868 ) +``` +""" +function print_results( iterations, elapsed ) + rate = iterations / elapsed + + @printf( " ---\n" ); + @printf( " iterations: %d\n", iterations ); + @printf( " elapsed: %0.9f\n", elapsed ); + @printf( " rate: %0.9f\n", rate ); + @printf( " ...\n" ); +end + +""" + benchmark() + +Run a benchmark. + +# Notes + +* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. +* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. +* The elapsed time is in seconds. + +# Examples + +``` julia +julia> out = benchmark(); +``` +""" +function benchmark() + t = BenchmarkTools.@benchmark minmaxabsf( (1000.0*rand())-500.0, (1000.0*rand())-500.0 ) samples=1e6 + + # Compute the total "elapsed" time and convert from nanoseconds to seconds: + s = sum( t.times ) / 1.0e9; + + # Determine the number of "iterations": + iter = length( t.times ); + + # Return the results: + [ iter, s ]; +end + +""" + main() + +Run benchmarks. + +# Examples + +``` julia +julia> main(); +``` +""" +function main() + print_version(); + for i in 1:repeats + @printf( "# julia::%s\n", name ); + results = benchmark(); + print_results( results[ 1 ], results[ 2 ] ); + @printf( "ok %d benchmark finished\n", i ); + end + print_summary( repeats, repeats ); +end + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt index e69de29bb2d1..db190f31e798 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/repl.txt @@ -0,0 +1,68 @@ + +{{alias}}( x, y ) + Returns the absolute single precision minimum and maximum values. + + If any argument is `NaN`, the function returns `NaN` for both the minimum + and maximum values. + + Parameters + ---------- + x: number + First number. + + y: number + Second number. + + Returns + ------- + out: Array + Minimum and maximum values. + + Examples + -------- + > var v = {{alias}}( 3.0, 4.0 ) + [ 3.0, 4.0 ] + > v = {{alias}}( 3.14, NaN ) + [ NaN, NaN ] + > v = {{alias}}( +0.0, -0.0 ) + [ +0.0, +0.0 ] + + +{{alias}}.assign( x, y, out, stride, offset ) + Returns the absolute single precision minimum and maximum values + + If any argument is `NaN`, the function returns `NaN` for both the minimum + and maximum values. + + Parameters + ---------- + x: number + First number. + + y: number + Second number. + + out: Array|TypedArray|Object + Output object. + + stride: integer + Output array stride. + + offset: integer + Output array index offset. + + Returns + ------- + out: Array|TypedArray|Object + Minimum and maximum values. + + Examples + -------- + > var out = [ 0.0, 0.0 ]; + > var v = {{alias}}.assign( 3.14, -1.5, out, 1, 0 ) + [ 1.5, 3.14 ] + > var bool = ( v === out ) + true + + See Also + -------- diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts index e69de29bb2d1..1b4067a0427a 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts @@ -0,0 +1,93 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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 + +/// + +import { Collection } from '@stdlib/types/array'; + +/** +* Interface describing an interface for computing minimum and maximum values. +*/ +interface MinMaxAbsf { + /** + * Returns the single-precision minimum and maximum values. + * + * @param x - first number + * @param y - second number + * @returns minimum and maximum values + * + * @example + * var v = minmaxabsf( 3.14, 4.2 ); + * // returns [ 3.14, 4.2 ] + * + * var v = minmaxabsf( 3.14, NaN ); + * // returns [ NaN, NaN ] + * + * @example + * var v = minmaxabsf( +0.0, -0.0 ); + * // returns [ 0.0, 0.0 ] + */ + ( x: number, y: number ): Array; + + /** + * Returns the single-precision minimum and maximum absolute values and assigns results to a provided output array. + * + * @param x - first number + * @param y - second number + * @param out - output object + * @param stride - output array stride + * @param offset - output array index offset + * @returns minimum and maximum values + * + * @example + * var out = [ 0.0, 0.0 ]; + * var v = minmaxabsf( 5.9, 3.14, out, 1, 0 ); + * // returns [ 3.14, 5.9 ] + * + * var bool = ( v === out ); + * // returns true + */ + assign( x: number, y: number, out: Collection, stride: number, offset: number ): Collection; +} + +/** +* Returns the minimum and maximum single-precision absolute values. +* +* @param x - first number +* @param y - second number +* @returns minimum and maximum values +* +* @example +* var v = minmaxabsf( 3.14, 4.2 ); +* // returns [ 3.14, 4.2 ] +* +* var v = minmaxabsf( 3.14, NaN ); +* // returns [ NaN, NaN ] +* +* @example +* var v = minmaxabsf( +0.0, -0.0 ); +* // returns [ 0.0, 0.0 ] +*/ +declare var minmaxabsf: MinMaxAbsf; + + +// EXPORTS // + +export = minmaxabsf; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts index e69de29bb2d1..b86d6f721c12 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts @@ -0,0 +1,129 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 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 float32Array from '@stdlib/array/float32'; +import minmaxabsf from './index'; + + +// TESTS // + +// The function returns an array of numbers... +{ + minmaxabsf( 3.0, -0.2 ); // $ExpectType number[] +} + +// The compiler throws an error if the function is provided an argument which is not a number... +{ + minmaxabsf( true, 1.0 ); // $ExpectError + minmaxabsf( false, 1.0 ); // $ExpectError + minmaxabsf( [], 1.0 ); // $ExpectError + minmaxabsf( {}, 1.0 ); // $ExpectError + minmaxabsf( 'abc', 1.0 ); // $ExpectError + minmaxabsf( ( x: number ): number => x, 1.0 ); // $ExpectError + + minmaxabsf( 1.2, true ); // $ExpectError + minmaxabsf( 1.2, false ); // $ExpectError + minmaxabsf( 1.2, [] ); // $ExpectError + minmaxabsf( 1.2, {} ); // $ExpectError + minmaxabsf( 1.2, 'abc' ); // $ExpectError + minmaxabsf( 1.2, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + minmaxabsf(); // $ExpectError + minmaxabsf( -0.2 ); // $ExpectError + minmaxabsf( 3.0, -0.2, -1.2 ); // $ExpectError + minmaxabsf( 3.0, -0.2, -1.2, -4.0 ); // $ExpectError + minmaxabsf( 3.0, -0.2, -1.2, -4.0, 5.0 ); // $ExpectError +} + +// Attached to the main export is an `assign` method which returns an array-like object containing numbers... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( 3.0, -0.2, out, 1, 0 ); // $ExpectType Collection +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not a number... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( true, 1.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( false, 1.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( '5', -0.2, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( null, 1.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( [], -4.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( {}, 5.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( ( x: number ): number => x, 6.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not a number... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( 1.0, false, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, '5', out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, null, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, [], out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, {}, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an invalid third argument... +{ + minmaxabsf.assign( 1.0, 3.0, false, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, null, 1, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, {}, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an invalid fourth argument... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( 1.0, 3.0, out, false, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, '5', 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, null, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, [], 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, {}, 0 ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an invalid fifth argument... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( 1.0, 3.0, out, 0, false ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, 0, '5' ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, 0, null ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, 0, [] ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, 0, {} ); // $ExpectError + minmaxabsf.assign( 1.0, 3.0, out, 0, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const out = new float32Array( 2 ); + + minmaxabsf.assign( out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 3.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 3.0, -0.2, 1.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 3.0, -0.2, -1.2, -4.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 3.0, -0.2, -1.2, -4.0, 5.0, out, 1, 0 ); // $ExpectError + minmaxabsf.assign( 3.0, -0.2, -1.2, -4.0, 5.0, 6.0, out, 1, 0 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile index e69de29bb2d1..6aed70daf167 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 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/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c index e69de29bb2d1..ea99a21c4a12 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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/special/minmaxabsf.h" +#include +#include + +int main( void ) { + float x; + float y; + float min; + float max; + int i; + + for ( i = 0; i < 100; i++ ) { + x = ( ( (float)rand() / (float)RAND_MAX ) * 1000.0f ) - 500.0f; + y = ( ( (float)rand() / (float)RAND_MAX ) * 1000.0f ) - 500.0f; + v = stdlib_base_minmaxabsf( x, y, min, max ); + printf( "x: %f, y: %f, minmaxabsf(x, y): %f %f\n", x, y, min, max ); + } +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi index e69de29bb2d1..575cb043c0bf 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2024 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': [ + '} minimum and maximum absolute single-precision floating-point values +* +* @example +* var v = minmaxabsf( 3.14, 4.2 ); +* // returns [ 3.14, 4.2 ] +* +* @example +* var v = minmaxabsf( 3.14, NaN ); +* // returns [ NaN, NaN ] +* +* @example +* var v = minmaxabsf( +0.0, -0.0 ); +* // returns [ 0.0, 0.0 ] +*/ +function minmaxabsf( x, y ) { + var out = new float32Array( 2 ); + x = float64ToFloat32( x ); + y = float64ToFloat32( y ); + return assign( x, y, out, 1, 0 ); +} + + +// EXPORTS // + +module.exports = minmaxabsf; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js index e69de29bb2d1..32bf29d63c70 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 addon = require( './../src/addon.node' ); +var float32Array = require( '@stdlib/array/float32' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Returns the minimum and maximum absolute single-precision floating-point values. +* @param {number} x - first number +* @param {number} y - second number +* @returns {Array} minimum and maximum absolute single-precision floating-point values +* +* @example +* var v = minmaxabsf( 3.14, 4.2 ); +* // returns [ 3.14, 4.2 ] +* +* @example +* var v = minmaxabsf( 3.14, NaN ); +* // returns [ NaN, NaN ] +* +* @example +* var v = minmaxabsf( +0.0, -0.0 ); +* // returns [ 0.0, 0.0 ] +*/ +function minmaxabsf( x, y ) { + var out; + x = float64ToFloat32( x ); + y = float64ToFloat32( y ); + out = new float32Array( 2 ); + addon( x, y, out ); + return out; +} + + +// EXPORTS // + +module.exports = minmaxabsf; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json index e69de29bb2d1..5f6a370e8f8f 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json @@ -0,0 +1,98 @@ +{ + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/argv", + "@stdlib/napi/export", + "@stdlib/napi/argv-float", + "@stdlib/napi/argv-float32array", + "@stdlib/math/base/assert/is-negative-zerof", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/special/absf", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/constants/float32/nan.h" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/argv", + "@stdlib/napi/export", + "@stdlib/napi/argv-float", + "@stdlib/napi/argv-float32array", + "@stdlib/math/base/assert/is-negative-zerof", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/special/absf", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/constants/float32/nan.h" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/argv", + "@stdlib/napi/export", + "@stdlib/napi/argv-float", + "@stdlib/napi/argv-float32array", + "@stdlib/math/base/assert/is-negative-zerof", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/napi/binary", + "@stdlib/math/base/special/absf", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/constants/float32/nan.h" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c index e69de29bb2d1..3204e4657ca8 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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/special/minmaxabsf.h" +#include "stdlib/math/base/napi/binary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_minmaxabsf ) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c index e69de29bb2d1..682e2114bc73 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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/special/minmaxabsf.h" +#include "stdlib/math/base/assert/is_nanf.h" +#include "stdlib/math/base/special/absf.h" +#include "stdlib/constants/float32/nan.h" + +/** +* Evaluates the single-precision min and max value. +* +* @param x first input +* @param y second input +* @param min output min +* @param max output max +* @return void +* +* @example +* float min; +* float max; +* float v = stdlib_base_minmaxabsf( 3.2, 4.1, &min, &max ); +* // returns [ 3.2f, 4.1f ] +* +* @example +* float min; +* float max; +* float v = stdlib_base_minmaxabsf( 4.0, 0.0/0.0, &min, &max ); +* // returns [ NaN, NaN ] +*/ +void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ){ + if ( stdlib_base_is_nanf( x ) || stdlib_base_is_nanf( y ) ) { + *min = STDLIB_CONSTANT_FLOAT32_NAN; + *max = STDLIB_CONSTANT_FLOAT32_NAN; + return; + } + float ax = stdlib_base_absf( x ); + float ay = stdlib_base_absf( y ); + if ( ax < ay ) { + *min = ax; + *max = ay; + return; + } + *min = ay; + *max = ax; + return; +} diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js index e69de29bb2d1..71683d32f335 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js @@ -0,0 +1,204 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); +var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var PINF = require( '@stdlib/constants/float32/pinf' ); +var NINF = require( '@stdlib/constants/float32/ninf' ); +var Float32Array = require( '@stdlib/array/float32' ); +var minmaxabsf = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof minmaxabsf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( NaN, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( 3.14, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( NaN, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `-Infinity`', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( NINF, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns -infinity' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( 3.14, NINF, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns -infinity' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `+Infinity`', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( PINF, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( 3.14, PINF, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + t.end(); +}); + +tape( 'the function returns correctly signed zeros', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( +0.0, -0.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isPositiveZero( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v[ 1 ] ), true, 'returns +0' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( -0.0, +0.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isPositiveZero( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v[ 1 ] ), true, 'returns +0' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( -0.0, -0.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isPositiveZero( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v[ 1 ] ), true, 'returns +0' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( +0.0, +0.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( isPositiveZero( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZero( v[ 1 ] ), true, 'returns +0' ); + + t.end(); +}); + +tape( 'the function returns the minimum and maximum single-precision floating-point absolute values', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( 4.2, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( -4.2, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + t.end(); +}); + +tape( 'the function supports providing an output object (array)', function test( t ) { + var out; + var v; + + out = new Float32Array( 2 ); + v = minmaxabsf( 4.2, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + out = new Float32Array( 2 ); + v = minmaxabsf( -4.2, 3.14, out, 1, 0 ); + t.strictEqual( v, out, 'returns output array' ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride', function test( t ) { + var out; + var val; + + out = new Float32Array( 4 ); + val = minmaxabsf( -4.2, 3.14, out, 2, 0 ); + + t.strictEqual( val, out, 'returns output array' ); + t.strictEqual( val[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( val[ 1 ], float64ToFloat32( 0 ), 'returns expected value' ); + t.strictEqual( val[ 2 ], float64ToFloat32( 4.2 ), 'returns expected value' ); + t.strictEqual( val[ 3 ], float64ToFloat32( 0 ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset', function test( t ) { + var out; + var val; + + out = new Float32Array( 4 ); + val = minmaxabsf( -4.2, 3.14, out, 2, 1 ); + + t.strictEqual( val, out, 'returns output array' ); + t.strictEqual( val[ 0 ], float64ToFloat32( 0 ), 'returns expected value' ); + t.strictEqual( val[ 1 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( val[ 2 ], float64ToFloat32( 0 ), 'returns expected value' ); + t.strictEqual( val[ 3 ], float64ToFloat32( 4.2 ), 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js index 836fc689363d..461faf012a2d 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js @@ -22,6 +22,7 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var PINF = require( '@stdlib/constants/float32/pinf' ); @@ -32,6 +33,74 @@ var minmaxabsf = require( './../lib' ); tape( 'main export is a function', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof minabsf, 'function', 'main export is a function' ); + t.strictEqual( typeof minmaxabsf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( hasOwnProp( minmaxabsf, 'assign' ), true, 'has property' ); + t.strictEqual( typeof minmaxabsf.assign, 'function', 'has method' ); + t.end(); +}); + +tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { + var v; + + v = minmaxabsf( NaN, float64ToFloat32( 3.14 ) ); + t.strictEqual( isnanf( v[0] ), true, 'returns expected value' ); + t.strictEqual( isnanf( v[1] ), true, 'returns expected value' ); + + v = minmaxabsf( float64ToFloat32( 3.14 ), NaN ); + t.strictEqual( isnanf( v[0] ), true, 'returns expected value' ); + t.strictEqual( isnanf( v[1] ), true, 'returns expected value' ); + + v = minmaxabsf( NaN, NaN ); + t.strictEqual( isnanf( v[0] ), true, 'returns expected value' ); + t.strictEqual( isnanf( v[1] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a correctly signed zero', function test( t ) { + var v; + + v = minmaxabsf( +0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[0] ), true, 'returns expected value' ); + t.strictEqual( isPositiveZerof( v[1] ), true, 'returns expected value' ); + + v = minmaxabsf( -0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[0] ), true, 'returns expected value' ); + t.strictEqual( isPositiveZerof( v[1] ), true, 'returns expected value' ); + + v = minmaxabsf( -0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[0] ), true, 'returns expected value' ); + t.strictEqual( isPositiveZerof( v[1] ), true, 'returns expected value' ); + + v = minmaxabsf( +0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[0] ), true, 'returns expected value' ); + t.strictEqual( isPositiveZerof( v[1] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the minimum and maximum absolute single-precision floating-point values', function test( t ) { + var v; + + v = minmaxabsf( float64ToFloat32( 4.2 ), float64ToFloat32( 3.14 ) ); + t.strictEqual( v[0], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[1], float64ToFloat32( 4.2 ), 'returns expected value' ); + + v = minmaxabsf( float64ToFloat32( -4.2 ), float64ToFloat32( 3.14 ) ); + t.strictEqual( v[0], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[1], float64ToFloat32( 4.2 ), 'returns expected value' ); + + v = minmaxabsf( PINF, float64ToFloat32( 3.14 ) ); + t.strictEqual( v[0], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[1], PINF, 'returns expected value' ); + + v = minmaxabsf( float64ToFloat32( 3.14 ), PINF ); + t.strictEqual( v[0], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[1], PINF, 'returns expected value' ); + t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js index e69de29bb2d1..c6fcd61c0691 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js @@ -0,0 +1,120 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var PINF = require( '@stdlib/constants/float32/pinf' ); +var NINF = require( '@stdlib/constants/float32/ninf' ); +var minmaxabsf = require( './../lib/main.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof minmaxabsf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `NaN` for both the minimum and maximum absolute single-precision floating-point values if provided a `NaN`', function test( t ) { + var v; + + v = minmaxabsf( NaN, 3.14 ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + v = minmaxabsf( 3.14, NaN ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + v = minmaxabsf( NaN, NaN ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `-Infinity`', function test( t ) { + var v; + + v = minmaxabsf( NINF, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns expected value' ); + + v = minmaxabsf( 3.14, NINF ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `+Infinity`', function test( t ) { + var v; + + v = minmaxabsf( PINF, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + v = minmaxabsf( 3.14, PINF ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + t.end(); +}); + +tape( 'the function returns correctly signed zeros', function test( t ) { + var v; + + v = minmaxabsf( +0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( -0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( -0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( +0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + t.end(); +}); + +tape( 'the function returns the minimum and maximum single-precision floating-point absolute values', function test( t ) { + var v; + + v = minmaxabsf( 4.2, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + v = minmaxabsf( -4.2, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js index e69de29bb2d1..e0b71080758a 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js @@ -0,0 +1,129 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var PINF = require( '@stdlib/constants/float32/pinf' ); +var NINF = require( '@stdlib/constants/float32/ninf' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var minmaxabsf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': (minmaxabsf instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof minmaxabsf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `NaN` for both the minimum and maximum value if provided a `NaN`', opts, function test( t ) { + var v; + + v = minmaxabsf( NaN, 3.14 ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + v = minmaxabsf( 3.14, NaN ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + v = minmaxabsf( NaN, NaN ); + t.strictEqual( isnanf( v[ 0 ] ), true, 'returns NaN' ); + t.strictEqual( isnanf( v[ 1 ] ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns correctly signed zeros', function test( t ) { + var v; + + v = minmaxabsf( +0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( -0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( -0.0, -0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + v = minmaxabsf( +0.0, +0.0 ); + t.strictEqual( isPositiveZerof( v[ 0 ] ), true, 'returns +0' ); + t.strictEqual( isPositiveZerof( v[ 1 ] ), true, 'returns +0' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `-Infinity`', function test( t ) { + var v; + + v = minmaxabsf( NINF, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns expected value' ); + + v = minmaxabsf( 3.14, NINF ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` as the maximum value if provided `+Infinity`', function test( t ) { + var v; + + v = minmaxabsf( PINF, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + v = minmaxabsf( 3.14, PINF ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns expected value' ); + t.strictEqual( v[ 1 ], PINF, 'returns +infinity' ); + + t.end(); +}); + +tape( 'the function returns the minimum and maximum single-precision floating-point absolute values', function test( t ) { + var v; + + v = minmaxabsf( 4.2, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + v = minmaxabsf( -4.2, 3.14 ); + t.strictEqual( v[ 0 ], float64ToFloat32( 3.14 ), 'returns min value' ); + t.strictEqual( v[ 1 ], float64ToFloat32( 4.2 ), 'returns max value' ); + + t.end(); +}); diff --git a/package.json b/package.json index 25b79ee80bb9..f28dee7b431c 100644 --- a/package.json +++ b/package.json @@ -1,296 +1 @@ -{ - "name": "@stdlib/stdlib", - "version": "0.3.2", - "description": "Standard library.", - "license": "Apache-2.0 AND BSL-1.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/stdlib" - }, - "bin": { - "stdlib": "./bin/cli" - }, - "main": "./lib", - "browser": { - "process": "process/" - }, - "directories": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "notes": "make notes", - "lint": "make lint", - "repl": "make repl", - "test": "make test", - "test-cov": "make test-cov", - "view-cov": "make view-cov", - "examples": "make examples", - "benchmark": "make benchmark", - "clean": "make clean", - "check-deps": "make check-deps", - "check-licenses": "make check-licenses" - }, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": { - "@stdlib/array": "^0.3.3", - "@stdlib/assert": "^0.3.3", - "@stdlib/bench": "^0.4.3", - "@stdlib/bigint": "^0.3.3", - "@stdlib/blas": "^0.3.3", - "@stdlib/boolean": "^0.3.3", - "@stdlib/buffer": "^0.3.3", - "@stdlib/cli": "^0.3.3", - "@stdlib/complex": "^0.3.3", - "@stdlib/console": "^0.3.3", - "@stdlib/constants": "^0.3.3", - "@stdlib/datasets": "^0.3.0", - "@stdlib/error": "^0.3.3", - "@stdlib/fs": "^0.3.3", - "@stdlib/function": "^0.3.3", - "@stdlib/iter": "^0.3.3", - "@stdlib/lapack": "^0.1.3", - "@stdlib/math": "^0.3.3", - "@stdlib/ml": "^0.3.3", - "@stdlib/namespace": "^0.3.3", - "@stdlib/napi": "^0.3.3", - "@stdlib/ndarray": "^0.3.3", - "@stdlib/net": "^0.3.3", - "@stdlib/nlp": "^0.3.3", - "@stdlib/number": "^0.3.3", - "@stdlib/object": "^0.3.3", - "@stdlib/os": "^0.3.3", - "@stdlib/plot": "^0.3.3", - "@stdlib/process": "^0.3.3", - "@stdlib/proxy": "^0.3.3", - "@stdlib/random": "^0.3.3", - "@stdlib/regexp": "^0.3.3", - "@stdlib/repl": "^0.3.3", - "@stdlib/simulate": "^0.3.3", - "@stdlib/slice": "^0.3.3", - "@stdlib/stats": "^0.3.3", - "@stdlib/streams": "^0.3.3", - "@stdlib/strided": "^0.3.3", - "@stdlib/string": "^0.3.3", - "@stdlib/symbol": "^0.3.3", - "@stdlib/time": "^0.3.3", - "@stdlib/types": "^0.4.3", - "@stdlib/utils": "^0.3.3", - "@stdlib/wasm": "^0.1.1", - "acorn": "^8.1.0", - "acorn-loose": "^8.0.2", - "acorn-walk": "^8.0.2", - "d3-format": "^1.0.0", - "d3-scale": "^1.0.0", - "d3-shape": "^1.0.0", - "d3-time-format": "^2.0.0", - "debug": "^2.6.9", - "glob": "^7.0.5", - "minimist": "^1.2.0", - "readable-stream": "^2.1.4", - "resolve": "^1.1.7", - "vdom-to-html": "^2.3.0", - "virtual-dom": "^2.1.1" - }, - "optionalDependencies": { - "node-gyp": "^9.3.1" - }, - "devDependencies": { - "0x": "^4.10.2", - "@cspell/eslint-plugin": "^8.8.0", - "@commitlint/cli": "^17.4.4", - "@commitlint/cz-commitlint": "^17.4.4", - "@conventional-commits/parser": "^0.4.1", - "@kaciras/deasync": "^1.0.1", - "@types/node": "^13.9.0", - "@typescript-eslint/parser": "^6.9.1", - "@typescript-eslint/eslint-plugin": "^6.9.1", - "ajv": "^5.2.2", - "browser-pack-flat": "^3.0.0", - "browserify": "^17.0.0", - "bundle-collapser": "^1.3.0", - "c8": "^7.12.0", - "chai": "^3.5.0", - "cheerio": "^1.0.0-rc.12", - "commitizen": "^4.3.0", - "common-shakeify": "^0.6.0", - "conventional-changelog-conventionalcommits": "^5.0.0", - "doctrine": "^3.0.0", - "editorconfig-checker": "^6.0.0", - "envify": "^4.0.0", - "eslint": "^8.57.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-expect-type": "^0.2.3", - "eslint-plugin-import": "^2.29.0", - "eslint-plugin-jsdoc": "^46.8.2", - "exorcist": "^2.0.0", - "factor-bundle": "^2.5.0", - "gh-pages": "git+https://github.com/Planeshifter/gh-pages.git#main", - "inquirer": "^8.0.0", - "jscodeshift": "^0.15.0", - "jsdoc": "^3.4.0", - "lunr": "^2.3.9", - "mathjax-node": "^2.0.1", - "mathjax-node-sre": "^3.0.0", - "mkdirp": "^0.5.1", - "mustache": "^4.0.0", - "parse-link-header": "^1.0.1", - "plato": "^1.5.0", - "process": "^0.11.10", - "proxyquire": "^2.0.0", - "proxyquire-universal": "^2.0.0", - "proxyquireify": "^3.1.1", - "read-installed": "^4.0.3", - "rehype": "^9.0.0", - "rehype-highlight": "^3.0.0", - "remark": "^11.0.1", - "remark-cli": "^7.0.0", - "remark-frontmatter": "^1.2.0", - "remark-html": "^10.0.0", - "remark-lint": "^6.0.0", - "remark-lint-blockquote-indentation": "^1.0.0", - "remark-lint-checkbox-character-style": "^1.0.0", - "remark-lint-checkbox-content-indent": "^1.0.0", - "remark-lint-code-block-style": "^1.0.0", - "remark-lint-definition-case": "^1.0.0", - "remark-lint-definition-spacing": "^1.0.0", - "remark-lint-emphasis-marker": "^1.0.0", - "remark-lint-fenced-code-flag": "^1.0.0", - "remark-lint-fenced-code-marker": "^1.0.0", - "remark-lint-file-extension": "^1.0.0", - "remark-lint-final-definition": "^1.0.0", - "remark-lint-final-newline": "^1.0.0", - "remark-lint-first-heading-level": "^1.1.0", - "remark-lint-hard-break-spaces": "^1.0.1", - "remark-lint-heading-increment": "^1.0.0", - "remark-lint-heading-style": "^1.0.0", - "remark-lint-linebreak-style": "^1.0.0", - "remark-lint-link-title-style": "^1.0.0", - "remark-lint-list-item-bullet-indent": "^1.0.0", - "remark-lint-list-item-content-indent": "^1.0.0", - "remark-lint-list-item-indent": "^1.0.0", - "remark-lint-list-item-spacing": "^1.1.0", - "remark-lint-maximum-heading-length": "^1.0.0", - "remark-lint-maximum-line-length": "^1.0.0", - "remark-lint-no-auto-link-without-protocol": "^1.0.0", - "remark-lint-no-blockquote-without-marker": "^2.0.0", - "remark-lint-no-consecutive-blank-lines": "^1.0.0", - "remark-lint-no-duplicate-definitions": "^1.0.0", - "remark-lint-no-duplicate-headings": "^1.0.0", - "remark-lint-no-duplicate-headings-in-section": "^1.0.0", - "remark-lint-no-emphasis-as-heading": "^1.0.0", - "remark-lint-no-empty-url": "^1.0.1", - "remark-lint-no-file-name-articles": "^1.0.0", - "remark-lint-no-file-name-consecutive-dashes": "^1.0.0", - "remark-lint-no-file-name-irregular-characters": "^1.0.0", - "remark-lint-no-file-name-mixed-case": "^1.0.0", - "remark-lint-no-file-name-outer-dashes": "^1.0.1", - "remark-lint-no-heading-content-indent": "^1.0.0", - "remark-lint-no-heading-indent": "^1.0.0", - "remark-lint-no-heading-like-paragraph": "^1.0.0", - "remark-lint-no-heading-punctuation": "^1.0.0", - "remark-lint-no-html": "^1.0.0", - "remark-lint-no-inline-padding": "^1.0.0", - "remark-lint-no-literal-urls": "^1.0.0", - "remark-lint-no-missing-blank-lines": "^1.0.0", - "remark-lint-no-multiple-toplevel-headings": "^1.0.0", - "remark-lint-no-paragraph-content-indent": "^1.0.1", - "remark-lint-no-reference-like-url": "^1.0.0", - "remark-lint-no-shell-dollars": "^1.0.0", - "remark-lint-no-shortcut-reference-image": "^1.0.0", - "remark-lint-no-shortcut-reference-link": "^1.0.1", - "remark-lint-no-table-indentation": "^1.0.0", - "remark-lint-no-tabs": "^1.0.0", - "remark-lint-no-trailing-spaces": "^3.0.2", - "remark-lint-no-undefined-references": "^1.0.0", - "remark-lint-no-unused-definitions": "^1.0.0", - "remark-lint-ordered-list-marker-style": "^1.0.0", - "remark-lint-ordered-list-marker-value": "^1.0.0", - "remark-lint-rule-style": "^1.0.0", - "remark-lint-strong-marker": "^1.0.0", - "remark-lint-table-cell-padding": "^1.0.0", - "remark-lint-table-pipe-alignment": "^1.0.0", - "remark-lint-table-pipes": "^1.0.0", - "remark-lint-unordered-list-marker-style": "^1.0.0", - "remark-slug": "^5.0.0", - "remark-unlink": "^2.0.0", - "remark-validate-links": "^9.0.1", - "remark-vdom": "^8.0.0", - "semver": "^6.0.0", - "source-map-explorer": "^2.5.3", - "spdx-license-ids": "^3.0.0", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "tap-spec": "5.x.x", - "tap-summary": "^4.0.0", - "tap-xunit": "^2.2.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "to-vfile": "^6.0.0", - "typedoc": "git+https://github.com/kgryte/typedoc.git#0.16.11-patch", - "typescript": "4.3.5", - "uglify-js": "^3.17.4", - "uglifyify": "^5.0.0", - "unified-lint-rule": "^1.0.1", - "unist-util-visit": "^2.0.0", - "unist-util-visit-parents": "^3.1.1", - "yaml": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdlib-js", - "stdlib.js", - "js-stdlib", - "stdlibjs", - "standard", - "std", - "library", - "lib", - "libstd", - "numerical", - "numeric", - "mathematical", - "mathematics", - "math", - "scientific", - "machine learning", - "machine-learning", - "ml", - "ndarray", - "numpy", - "scipy" - ] -} +{"name":"@stdlib/stdlib","version":"0.0.0"} From 79fa76e34a8fcdbaa56246438fdedadfc93dc06c Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Sun, 23 Mar 2025 12:20:06 +0000 Subject: [PATCH 03/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. --- 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: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - 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 --- --- etc/npm/deps.txt | 2 +- .../math/base/special/minmaxabsf/README.md | 17 +- .../special/minmaxabsf/benchmark/benchmark.js | 3 - .../stdlib/math/base/special/minmaxabsf.h | 2 +- .../base/special/minmaxabsf/lib/assign.js | 8 +- .../math/base/special/minmaxabsf/lib/main.js | 6 +- .../base/special/minmaxabsf/lib/native.js | 6 +- .../base/special/minmaxabsf/manifest.json | 9 +- .../math/base/special/minmaxabsf/src/addon.c | 17 +- .../math/base/special/minmaxabsf/src/main.c | 6 +- .../special/minmaxabsf/test/test.assign.js | 1 - package.json | 297 +++++++++++++++++- 12 files changed, 339 insertions(+), 35 deletions(-) diff --git a/etc/npm/deps.txt b/etc/npm/deps.txt index 8b137891791f..ce3c5bbaed3f 100644 --- a/etc/npm/deps.txt +++ b/etc/npm/deps.txt @@ -1 +1 @@ - +acorn@"^8.1.0" acorn-loose@"^8.0.2" acorn-walk@"^8.0.2" d3-format@"^1.0.0" d3-scale@"^1.0.0" d3-shape@"^1.0.0" d3-time-format@"^2.0.0" debug@"^2.6.9" glob@"^7.0.5" minimist@"^1.2.0" readable-stream@"^2.1.4" resolve@"^1.1.7" vdom-to-html@"^2.3.0" virtual-dom@"^2.1.1" 0x@"^4.10.2" @cspell/eslint-plugin@"^8.8.0" @commitlint/cli@"^17.4.4" @commitlint/cz-commitlint@"^17.4.4" @conventional-commits/parser@"^0.4.1" @kaciras/deasync@"^1.0.1" @types/node@"^13.9.0" @typescript-eslint/parser@"^6.9.1" @typescript-eslint/eslint-plugin@"^6.9.1" ajv@"^5.2.2" browser-pack-flat@"^3.0.0" browserify@"^17.0.0" bundle-collapser@"^1.3.0" c8@"^7.12.0" chai@"^3.5.0" cheerio@"^1.0.0-rc.12" commitizen@"^4.3.0" common-shakeify@"^0.6.0" conventional-changelog-conventionalcommits@"^5.0.0" doctrine@"^3.0.0" editorconfig-checker@"^6.0.0" envify@"^4.0.0" eslint@"^8.57.0" eslint-plugin-node@"^11.1.0" eslint-plugin-expect-type@"^0.2.3" eslint-plugin-import@"^2.29.0" eslint-plugin-jsdoc@"^46.8.2" exorcist@"^2.0.0" factor-bundle@"^2.5.0" gh-pages@"git+https://github.com/Planeshifter/gh-pages.git#main" inquirer@"^8.0.0" jscodeshift@"^0.15.0" jsdoc@"^3.4.0" lunr@"^2.3.9" mathjax-node@"^2.0.1" mathjax-node-sre@"^3.0.0" mkdirp@"^0.5.1" mustache@"^4.0.0" parse-link-header@"^1.0.1" plato@"^1.5.0" process@"^0.11.10" proxyquire@"^2.0.0" proxyquire-universal@"^2.0.0" proxyquireify@"^3.1.1" read-installed@"^4.0.3" rehype@"^9.0.0" rehype-highlight@"^3.0.0" remark@"^11.0.1" remark-cli@"^7.0.0" remark-frontmatter@"^1.2.0" remark-html@"^10.0.0" remark-lint@"^6.0.0" remark-lint-blockquote-indentation@"^1.0.0" remark-lint-checkbox-character-style@"^1.0.0" remark-lint-checkbox-content-indent@"^1.0.0" remark-lint-code-block-style@"^1.0.0" remark-lint-definition-case@"^1.0.0" remark-lint-definition-spacing@"^1.0.0" remark-lint-emphasis-marker@"^1.0.0" remark-lint-fenced-code-flag@"^1.0.0" remark-lint-fenced-code-marker@"^1.0.0" remark-lint-file-extension@"^1.0.0" remark-lint-final-definition@"^1.0.0" remark-lint-final-newline@"^1.0.0" remark-lint-first-heading-level@"^1.1.0" remark-lint-hard-break-spaces@"^1.0.1" remark-lint-heading-increment@"^1.0.0" remark-lint-heading-style@"^1.0.0" remark-lint-linebreak-style@"^1.0.0" remark-lint-link-title-style@"^1.0.0" remark-lint-list-item-bullet-indent@"^1.0.0" remark-lint-list-item-content-indent@"^1.0.0" remark-lint-list-item-indent@"^1.0.0" remark-lint-list-item-spacing@"^1.1.0" remark-lint-maximum-heading-length@"^1.0.0" remark-lint-maximum-line-length@"^1.0.0" remark-lint-no-auto-link-without-protocol@"^1.0.0" remark-lint-no-blockquote-without-marker@"^2.0.0" remark-lint-no-consecutive-blank-lines@"^1.0.0" remark-lint-no-duplicate-definitions@"^1.0.0" remark-lint-no-duplicate-headings@"^1.0.0" remark-lint-no-duplicate-headings-in-section@"^1.0.0" remark-lint-no-emphasis-as-heading@"^1.0.0" remark-lint-no-empty-url@"^1.0.1" remark-lint-no-file-name-articles@"^1.0.0" remark-lint-no-file-name-consecutive-dashes@"^1.0.0" remark-lint-no-file-name-irregular-characters@"^1.0.0" remark-lint-no-file-name-mixed-case@"^1.0.0" remark-lint-no-file-name-outer-dashes@"^1.0.1" remark-lint-no-heading-content-indent@"^1.0.0" remark-lint-no-heading-indent@"^1.0.0" remark-lint-no-heading-like-paragraph@"^1.0.0" remark-lint-no-heading-punctuation@"^1.0.0" remark-lint-no-html@"^1.0.0" remark-lint-no-inline-padding@"^1.0.0" remark-lint-no-literal-urls@"^1.0.0" remark-lint-no-missing-blank-lines@"^1.0.0" remark-lint-no-multiple-toplevel-headings@"^1.0.0" remark-lint-no-paragraph-content-indent@"^1.0.1" remark-lint-no-reference-like-url@"^1.0.0" remark-lint-no-shell-dollars@"^1.0.0" remark-lint-no-shortcut-reference-image@"^1.0.0" remark-lint-no-shortcut-reference-link@"^1.0.1" remark-lint-no-table-indentation@"^1.0.0" remark-lint-no-tabs@"^1.0.0" remark-lint-no-trailing-spaces@"^3.0.2" remark-lint-no-undefined-references@"^1.0.0" remark-lint-no-unused-definitions@"^1.0.0" remark-lint-ordered-list-marker-style@"^1.0.0" remark-lint-ordered-list-marker-value@"^1.0.0" remark-lint-rule-style@"^1.0.0" remark-lint-strong-marker@"^1.0.0" remark-lint-table-cell-padding@"^1.0.0" remark-lint-table-pipe-alignment@"^1.0.0" remark-lint-table-pipes@"^1.0.0" remark-lint-unordered-list-marker-style@"^1.0.0" remark-slug@"^5.0.0" remark-unlink@"^2.0.0" remark-validate-links@"^9.0.1" remark-vdom@"^8.0.0" semver@"^6.0.0" source-map-explorer@"^2.5.3" spdx-license-ids@"^3.0.0" tap-min@"git+https://github.com/Planeshifter/tap-min.git" tap-spec@"5.x.x" tap-summary@"^4.0.0" tap-xunit@"^2.2.0" tape@"git+https://github.com/kgryte/tape.git#fix/globby" to-vfile@"^6.0.0" typedoc@"git+https://github.com/kgryte/typedoc.git#0.16.11-patch" typescript@"4.3.5" uglify-js@"^3.17.4" uglifyify@"^5.0.0" unified-lint-rule@"^1.0.1" unist-util-visit@"^2.0.0" unist-util-visit-parents@"^3.1.1" yaml@"^1.0.0" node-gyp@"^9.3.1" diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index 673cf7a5881a..d1af51482247 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -45,21 +45,21 @@ var minmaxabsf = require( '@stdlib/math/base/special/minmaxabsf' ); Returns the minimum and maximum absolute single-precision floating-point values in a single pass. ```javascript -var v = minmaxabsf( 4.2, 3.14 ); -// returns [ 3.14, 4.2 ] +var v = minmaxabsf( 4.0, 3.0 ); +// returns [ 3.0, 4.0 ] v = minmaxabsf( +0.0, -0.0 ); -// returns [ 0.0, 0.0 ] +// returns [ 0.0, 0.0 ] ``` If any argument is `NaN`, the function returns `Nan` for both the minimum value and the maximum value. ```javascript -var v = minmaxabs( 4.2, NaN ); -// returns [ NaN, NaN ] +var v = minmaxabsf( 4.2, NaN ); +// returns [ NaN, NaN ] -v = minmaxabs( NaN, 3.14 ); -// returns [ NaN, NaN ] +v = minmaxabsf( NaN, 3.14 ); +// returns [ NaN, NaN ] ``` #### minmaxabsf.assign( x, y, out, stride, offset ) @@ -67,7 +67,7 @@ v = minmaxabs( NaN, 3.14 ); Returns the minimum and maximum absolute single-precision values in a single pass and assigns the results to a provided output array. ```javascript -var Float64Array = require( '@stdlib/array/float32' ); +var Float32Array = require( '@stdlib/array/float32' ); var out = new Float32Array( 2 ); @@ -160,6 +160,7 @@ stdlib_base_minmaxabsf( 0.0f, -0.0f, &min, &max ); ``` The function accepts the following arguments: + - **x**: `[in] float` input value. - **y**: `[in] float` input value. - **min**: `[in] *float` output min. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js index ca53576ec6a4..b936ecc0f1ea 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js @@ -23,9 +23,6 @@ var bench = require( '@stdlib/bench' ); var randu = require( '@stdlib/random/base/randn' ); var isFloat32Array = require( '@stdlib/assert/is-float32array' ); -var isArray = require( '@stdlib/assert/is-array' ); -var minf = require( '@stdlib/math/base/special/minf' ); -var maxf = require( '@stdlib/math/base/special/maxf' ); var float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var minmaxabsf = require( './../lib' ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h index 91a2c3ce3d0b..0522fbfa59a2 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h @@ -29,7 +29,7 @@ extern "C" { /** * Returns the minimum and maximum absolute single-precision floating-point number. */ -float stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ); +void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js index 5ef7b3a58565..08524d193d4d 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js @@ -40,7 +40,7 @@ var absf = require( '@stdlib/math/base/special/absf' ); * @example * var out = [ 0.0, 0.0 ]; * var v = minmaxabsf( 3.14, 4.2, out, 1, 0 ); -* // returns [ 3.14, 4.2 ] +* // returns [ 3.14, 4.2 ] * * var bool = ( v === out ); * // returns true @@ -48,17 +48,17 @@ var absf = require( '@stdlib/math/base/special/absf' ); * @example * var out = [ 0.0, 0.0 ]; * var v = minmaxabsf( -5.9, 3.14, out, 1, 0 ); -* // returns [ 3.14, 5.9 ] +* // returns [ 3.14, 5.9 ] * * @example * var out = [ 0.0, 0.0 ]; * var v = minmaxabsf( 3.14, NaN, out, 1, 0 ); -* // returns [ NaN, NaN ] +* // returns [ NaN, NaN ] * * @example * var out = [ 0.0, 0.0 ]; * var v = minmaxabsf( +0.0, -0.0, out, 1, 0 ); -* // returns [ 0.0, 0.0 ] +* // returns [ 0.0, 0.0 ] */ function minmaxabsf( x, y, out, stride, offset ) { var ax; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js index 7f4a81513940..701426ecc667 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js @@ -35,8 +35,8 @@ var assign = require( './assign.js' ); * @returns {Array} minimum and maximum absolute single-precision floating-point values * * @example -* var v = minmaxabsf( 3.14, 4.2 ); -* // returns [ 3.14, 4.2 ] +* var v = minmaxabsf( 3.0, 4.0 ); +* // returns [ 3.0, 4.0 ] * * @example * var v = minmaxabsf( 3.14, NaN ); @@ -47,7 +47,7 @@ var assign = require( './assign.js' ); * // returns [ 0.0, 0.0 ] */ function minmaxabsf( x, y ) { - var out = new float32Array( 2 ); + var out = new float32Array( 2 ); x = float64ToFloat32( x ); y = float64ToFloat32( y ); return assign( x, y, out, 1, 0 ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js index 32bf29d63c70..01e09ffa78c4 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js @@ -20,9 +20,9 @@ // MODULES // -var addon = require( './../src/addon.node' ); var float32Array = require( '@stdlib/array/float32' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var addon = require( './../src/addon.node' ); // MAIN // @@ -34,8 +34,8 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); * @returns {Array} minimum and maximum absolute single-precision floating-point values * * @example -* var v = minmaxabsf( 3.14, 4.2 ); -* // returns [ 3.14, 4.2 ] +* var v = minmaxabsf( 3.0, 4.0 ); +* // returns [ 3.0, 4.0 ] * * @example * var v = minmaxabsf( 3.14, NaN ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json index 5f6a370e8f8f..66c5015874d8 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json @@ -44,8 +44,7 @@ "@stdlib/math/base/assert/is-nanf", "@stdlib/math/base/napi/binary", "@stdlib/math/base/special/absf", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/constants/float32/nan.h" + "@stdlib/math/base/assert/is-nanf" ] }, { @@ -67,8 +66,7 @@ "@stdlib/math/base/assert/is-nanf", "@stdlib/math/base/napi/binary", "@stdlib/math/base/special/absf", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/constants/float32/nan.h" + "@stdlib/math/base/assert/is-nanf" ] }, { @@ -90,8 +88,7 @@ "@stdlib/math/base/assert/is-nanf", "@stdlib/math/base/napi/binary", "@stdlib/math/base/special/absf", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/constants/float32/nan.h" + "@stdlib/math/base/assert/is-nanf" ] } ] diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c index 3204e4657ca8..0c41a84faa54 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c @@ -18,6 +18,21 @@ #include "stdlib/math/base/special/minmaxabsf.h" #include "stdlib/math/base/napi/binary.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_float.h" +#include "stdlib/napi/argv_float32array.h" +#include "stdlib/napi/export.h" +#include + +static napi_value addon( napi_env env, napi_callback_info info ){ + STDLIB_NAPI_ARGV( env, info, argv, argc, 3 ); + STDLIB_NAPI_ARGV_FLOAT( env, x, argv, 0 ); + STDLIB_NAPI_ARGV_FLOAT( env, y, argv, 1 ); + STDLIB_NAPI_ARGV_FLOAT32ARRAY(env, out, len, argv, 2 ); + STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_minmaxabsf ); + stdlib_base_minmaxabsf( x, y, &out[0], &out[1] ); + return NULL; +} // cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_minmaxabsf ) +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c index 682e2114bc73..bc11d4a5b811 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c @@ -19,7 +19,7 @@ #include "stdlib/math/base/special/minmaxabsf.h" #include "stdlib/math/base/assert/is_nanf.h" #include "stdlib/math/base/special/absf.h" -#include "stdlib/constants/float32/nan.h" +// #include "stdlib/constants/float32/nan.h" /** * Evaluates the single-precision min and max value. @@ -44,8 +44,8 @@ */ void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ){ if ( stdlib_base_is_nanf( x ) || stdlib_base_is_nanf( y ) ) { - *min = STDLIB_CONSTANT_FLOAT32_NAN; - *max = STDLIB_CONSTANT_FLOAT32_NAN; + *min = 0.0f/0.0f; + *max = 0.0f/0.0f; return; } float ax = stdlib_base_absf( x ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js index 71683d32f335..b77c77c98dc3 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js @@ -22,7 +22,6 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); var PINF = require( '@stdlib/constants/float32/pinf' ); diff --git a/package.json b/package.json index f28dee7b431c..25b79ee80bb9 100644 --- a/package.json +++ b/package.json @@ -1 +1,296 @@ -{"name":"@stdlib/stdlib","version":"0.0.0"} +{ + "name": "@stdlib/stdlib", + "version": "0.3.2", + "description": "Standard library.", + "license": "Apache-2.0 AND BSL-1.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/stdlib" + }, + "bin": { + "stdlib": "./bin/cli" + }, + "main": "./lib", + "browser": { + "process": "process/" + }, + "directories": { + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": { + "notes": "make notes", + "lint": "make lint", + "repl": "make repl", + "test": "make test", + "test-cov": "make test-cov", + "view-cov": "make view-cov", + "examples": "make examples", + "benchmark": "make benchmark", + "clean": "make clean", + "check-deps": "make check-deps", + "check-licenses": "make check-licenses" + }, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": { + "@stdlib/array": "^0.3.3", + "@stdlib/assert": "^0.3.3", + "@stdlib/bench": "^0.4.3", + "@stdlib/bigint": "^0.3.3", + "@stdlib/blas": "^0.3.3", + "@stdlib/boolean": "^0.3.3", + "@stdlib/buffer": "^0.3.3", + "@stdlib/cli": "^0.3.3", + "@stdlib/complex": "^0.3.3", + "@stdlib/console": "^0.3.3", + "@stdlib/constants": "^0.3.3", + "@stdlib/datasets": "^0.3.0", + "@stdlib/error": "^0.3.3", + "@stdlib/fs": "^0.3.3", + "@stdlib/function": "^0.3.3", + "@stdlib/iter": "^0.3.3", + "@stdlib/lapack": "^0.1.3", + "@stdlib/math": "^0.3.3", + "@stdlib/ml": "^0.3.3", + "@stdlib/namespace": "^0.3.3", + "@stdlib/napi": "^0.3.3", + "@stdlib/ndarray": "^0.3.3", + "@stdlib/net": "^0.3.3", + "@stdlib/nlp": "^0.3.3", + "@stdlib/number": "^0.3.3", + "@stdlib/object": "^0.3.3", + "@stdlib/os": "^0.3.3", + "@stdlib/plot": "^0.3.3", + "@stdlib/process": "^0.3.3", + "@stdlib/proxy": "^0.3.3", + "@stdlib/random": "^0.3.3", + "@stdlib/regexp": "^0.3.3", + "@stdlib/repl": "^0.3.3", + "@stdlib/simulate": "^0.3.3", + "@stdlib/slice": "^0.3.3", + "@stdlib/stats": "^0.3.3", + "@stdlib/streams": "^0.3.3", + "@stdlib/strided": "^0.3.3", + "@stdlib/string": "^0.3.3", + "@stdlib/symbol": "^0.3.3", + "@stdlib/time": "^0.3.3", + "@stdlib/types": "^0.4.3", + "@stdlib/utils": "^0.3.3", + "@stdlib/wasm": "^0.1.1", + "acorn": "^8.1.0", + "acorn-loose": "^8.0.2", + "acorn-walk": "^8.0.2", + "d3-format": "^1.0.0", + "d3-scale": "^1.0.0", + "d3-shape": "^1.0.0", + "d3-time-format": "^2.0.0", + "debug": "^2.6.9", + "glob": "^7.0.5", + "minimist": "^1.2.0", + "readable-stream": "^2.1.4", + "resolve": "^1.1.7", + "vdom-to-html": "^2.3.0", + "virtual-dom": "^2.1.1" + }, + "optionalDependencies": { + "node-gyp": "^9.3.1" + }, + "devDependencies": { + "0x": "^4.10.2", + "@cspell/eslint-plugin": "^8.8.0", + "@commitlint/cli": "^17.4.4", + "@commitlint/cz-commitlint": "^17.4.4", + "@conventional-commits/parser": "^0.4.1", + "@kaciras/deasync": "^1.0.1", + "@types/node": "^13.9.0", + "@typescript-eslint/parser": "^6.9.1", + "@typescript-eslint/eslint-plugin": "^6.9.1", + "ajv": "^5.2.2", + "browser-pack-flat": "^3.0.0", + "browserify": "^17.0.0", + "bundle-collapser": "^1.3.0", + "c8": "^7.12.0", + "chai": "^3.5.0", + "cheerio": "^1.0.0-rc.12", + "commitizen": "^4.3.0", + "common-shakeify": "^0.6.0", + "conventional-changelog-conventionalcommits": "^5.0.0", + "doctrine": "^3.0.0", + "editorconfig-checker": "^6.0.0", + "envify": "^4.0.0", + "eslint": "^8.57.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-expect-type": "^0.2.3", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-jsdoc": "^46.8.2", + "exorcist": "^2.0.0", + "factor-bundle": "^2.5.0", + "gh-pages": "git+https://github.com/Planeshifter/gh-pages.git#main", + "inquirer": "^8.0.0", + "jscodeshift": "^0.15.0", + "jsdoc": "^3.4.0", + "lunr": "^2.3.9", + "mathjax-node": "^2.0.1", + "mathjax-node-sre": "^3.0.0", + "mkdirp": "^0.5.1", + "mustache": "^4.0.0", + "parse-link-header": "^1.0.1", + "plato": "^1.5.0", + "process": "^0.11.10", + "proxyquire": "^2.0.0", + "proxyquire-universal": "^2.0.0", + "proxyquireify": "^3.1.1", + "read-installed": "^4.0.3", + "rehype": "^9.0.0", + "rehype-highlight": "^3.0.0", + "remark": "^11.0.1", + "remark-cli": "^7.0.0", + "remark-frontmatter": "^1.2.0", + "remark-html": "^10.0.0", + "remark-lint": "^6.0.0", + "remark-lint-blockquote-indentation": "^1.0.0", + "remark-lint-checkbox-character-style": "^1.0.0", + "remark-lint-checkbox-content-indent": "^1.0.0", + "remark-lint-code-block-style": "^1.0.0", + "remark-lint-definition-case": "^1.0.0", + "remark-lint-definition-spacing": "^1.0.0", + "remark-lint-emphasis-marker": "^1.0.0", + "remark-lint-fenced-code-flag": "^1.0.0", + "remark-lint-fenced-code-marker": "^1.0.0", + "remark-lint-file-extension": "^1.0.0", + "remark-lint-final-definition": "^1.0.0", + "remark-lint-final-newline": "^1.0.0", + "remark-lint-first-heading-level": "^1.1.0", + "remark-lint-hard-break-spaces": "^1.0.1", + "remark-lint-heading-increment": "^1.0.0", + "remark-lint-heading-style": "^1.0.0", + "remark-lint-linebreak-style": "^1.0.0", + "remark-lint-link-title-style": "^1.0.0", + "remark-lint-list-item-bullet-indent": "^1.0.0", + "remark-lint-list-item-content-indent": "^1.0.0", + "remark-lint-list-item-indent": "^1.0.0", + "remark-lint-list-item-spacing": "^1.1.0", + "remark-lint-maximum-heading-length": "^1.0.0", + "remark-lint-maximum-line-length": "^1.0.0", + "remark-lint-no-auto-link-without-protocol": "^1.0.0", + "remark-lint-no-blockquote-without-marker": "^2.0.0", + "remark-lint-no-consecutive-blank-lines": "^1.0.0", + "remark-lint-no-duplicate-definitions": "^1.0.0", + "remark-lint-no-duplicate-headings": "^1.0.0", + "remark-lint-no-duplicate-headings-in-section": "^1.0.0", + "remark-lint-no-emphasis-as-heading": "^1.0.0", + "remark-lint-no-empty-url": "^1.0.1", + "remark-lint-no-file-name-articles": "^1.0.0", + "remark-lint-no-file-name-consecutive-dashes": "^1.0.0", + "remark-lint-no-file-name-irregular-characters": "^1.0.0", + "remark-lint-no-file-name-mixed-case": "^1.0.0", + "remark-lint-no-file-name-outer-dashes": "^1.0.1", + "remark-lint-no-heading-content-indent": "^1.0.0", + "remark-lint-no-heading-indent": "^1.0.0", + "remark-lint-no-heading-like-paragraph": "^1.0.0", + "remark-lint-no-heading-punctuation": "^1.0.0", + "remark-lint-no-html": "^1.0.0", + "remark-lint-no-inline-padding": "^1.0.0", + "remark-lint-no-literal-urls": "^1.0.0", + "remark-lint-no-missing-blank-lines": "^1.0.0", + "remark-lint-no-multiple-toplevel-headings": "^1.0.0", + "remark-lint-no-paragraph-content-indent": "^1.0.1", + "remark-lint-no-reference-like-url": "^1.0.0", + "remark-lint-no-shell-dollars": "^1.0.0", + "remark-lint-no-shortcut-reference-image": "^1.0.0", + "remark-lint-no-shortcut-reference-link": "^1.0.1", + "remark-lint-no-table-indentation": "^1.0.0", + "remark-lint-no-tabs": "^1.0.0", + "remark-lint-no-trailing-spaces": "^3.0.2", + "remark-lint-no-undefined-references": "^1.0.0", + "remark-lint-no-unused-definitions": "^1.0.0", + "remark-lint-ordered-list-marker-style": "^1.0.0", + "remark-lint-ordered-list-marker-value": "^1.0.0", + "remark-lint-rule-style": "^1.0.0", + "remark-lint-strong-marker": "^1.0.0", + "remark-lint-table-cell-padding": "^1.0.0", + "remark-lint-table-pipe-alignment": "^1.0.0", + "remark-lint-table-pipes": "^1.0.0", + "remark-lint-unordered-list-marker-style": "^1.0.0", + "remark-slug": "^5.0.0", + "remark-unlink": "^2.0.0", + "remark-validate-links": "^9.0.1", + "remark-vdom": "^8.0.0", + "semver": "^6.0.0", + "source-map-explorer": "^2.5.3", + "spdx-license-ids": "^3.0.0", + "tap-min": "git+https://github.com/Planeshifter/tap-min.git", + "tap-spec": "5.x.x", + "tap-summary": "^4.0.0", + "tap-xunit": "^2.2.0", + "tape": "git+https://github.com/kgryte/tape.git#fix/globby", + "to-vfile": "^6.0.0", + "typedoc": "git+https://github.com/kgryte/typedoc.git#0.16.11-patch", + "typescript": "4.3.5", + "uglify-js": "^3.17.4", + "uglifyify": "^5.0.0", + "unified-lint-rule": "^1.0.1", + "unist-util-visit": "^2.0.0", + "unist-util-visit-parents": "^3.1.1", + "yaml": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdlib-js", + "stdlib.js", + "js-stdlib", + "stdlibjs", + "standard", + "std", + "library", + "lib", + "libstd", + "numerical", + "numeric", + "mathematical", + "mathematics", + "math", + "scientific", + "machine learning", + "machine-learning", + "ml", + "ndarray", + "numpy", + "scipy" + ] +} From a459008e829224535edc86972a41edf30ad1c3da Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Sun, 23 Mar 2025 13:31:49 +0000 Subject: [PATCH 04/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. --- 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 --- --- lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index d1af51482247..c6045565b798 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -100,7 +100,7 @@ var bool = ( v === out ); ```javascript var randu = require( '@stdlib/random/base/randu' ); -var minmaxabs = require( '@stdlib/math/base/special/minmaxabsf' ); +var minmaxabsf = require( '@stdlib/math/base/special/minmaxabsf' ); var x; var y; From e4244dba4e66361cfd4564d98ded06231444105c Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Mon, 24 Mar 2025 07:56:25 +0000 Subject: [PATCH 05/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. --- 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: passed - 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 --- --- .../math/base/special/cbrtf/benchmark/c/native/benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c index 9fabb7990e4e..46b4a5522f77 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c @@ -102,7 +102,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_cbrtf( x[ i%x.length ] ); + y = stdlib_base_cbrtf( x[ i%(sizeof(x)/sizeof(x[0])) ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; From 14ff772db612490e146a6d324e7b9d73bd84c48b Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Mon, 24 Mar 2025 12:43:49 +0000 Subject: [PATCH 06/16] feat!: add implementation of stdlib/math/base/special/minmaxabsf This commit adds the implementation of stdlib/math/base/special/minmaxabsf function. It includes a README.md file, benchmarks, tests, examples. The minmaxabsf function returns the minimum and maximum single-precision floating-point values for any two numbers. --- 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: passed - 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 --- --- .../math/base/special/gamma-lanczos-sum/benchmark/benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js index c3f597245b9c..191fac9e22d2 100644 --- a/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var gammaLanczosSum = require( './../lib' ); From f79ffcf47429d707e4dd6f1e694dc6f8a68e01e0 Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Wed, 26 Mar 2025 21:34:43 +0000 Subject: [PATCH 07/16] feat!: Committing changes for draft review --- .../minmaxabsf/benchmark/c/native/benchmark.c | 8 ++++---- .../base/special/minmaxabsf/examples/c/example.c | 2 +- .../math/base/special/minmaxabsf/manifest.json | 12 +++--------- .../math/base/special/minmaxabsf/package.json | 2 ++ .../@stdlib/math/base/special/minmaxabsf/src/addon.c | 10 +++++++--- .../@stdlib/math/base/special/minmaxabsf/src/main.c | 3 --- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c index 9013b3afab88..512b43bb2e51 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c @@ -79,9 +79,9 @@ static double tic( void ) { * * @return random number */ -static double rand_double( void ) { +static float rand_float( void ) { int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); + return (float)r / ( (float)RAND_MAX + 1.0f ); } /** @@ -99,8 +99,8 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - x[ i ] = ( 1000.0f * rand_double() ) - 500.0f; - y[ i ] = ( 1000.0f * rand_double() ) - 500.0f; + x[ i ] = ( 1000.0f * rand_float() ) - 500.0f; + y[ i ] = ( 1000.0f * rand_float() ) - 500.0f; } t = tic(); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c index ea99a21c4a12..7e9edbd58592 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c @@ -30,7 +30,7 @@ int main( void ) { for ( i = 0; i < 100; i++ ) { x = ( ( (float)rand() / (float)RAND_MAX ) * 1000.0f ) - 500.0f; y = ( ( (float)rand() / (float)RAND_MAX ) * 1000.0f ) - 500.0f; - v = stdlib_base_minmaxabsf( x, y, min, max ); + stdlib_base_minmaxabsf( x, y, &min, &max ); printf( "x: %f, y: %f, minmaxabsf(x, y): %f %f\n", x, y, min, max ); } } diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json index 66c5015874d8..591a3431fde8 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json @@ -40,9 +40,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv-float", "@stdlib/napi/argv-float32array", - "@stdlib/math/base/assert/is-negative-zerof", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/math/base/napi/binary", + "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ] @@ -62,9 +60,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv-float", "@stdlib/napi/argv-float32array", - "@stdlib/math/base/assert/is-negative-zerof", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/math/base/napi/binary", + "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ] @@ -84,9 +80,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv-float", "@stdlib/napi/argv-float32array", - "@stdlib/math/base/assert/is-negative-zerof", - "@stdlib/math/base/assert/is-nanf", - "@stdlib/math/base/napi/binary", + "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ] diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json index 921291c34214..f719fe3fcba1 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/package.json @@ -19,7 +19,9 @@ "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c index 0c41a84faa54..55a61bdc61ec 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c @@ -17,22 +17,26 @@ */ #include "stdlib/math/base/special/minmaxabsf.h" -#include "stdlib/math/base/napi/binary.h" #include "stdlib/napi/argv.h" #include "stdlib/napi/argv_float.h" #include "stdlib/napi/argv_float32array.h" #include "stdlib/napi/export.h" #include +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ static napi_value addon( napi_env env, napi_callback_info info ){ STDLIB_NAPI_ARGV( env, info, argv, argc, 3 ); STDLIB_NAPI_ARGV_FLOAT( env, x, argv, 0 ); STDLIB_NAPI_ARGV_FLOAT( env, y, argv, 1 ); STDLIB_NAPI_ARGV_FLOAT32ARRAY(env, out, len, argv, 2 ); - STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_minmaxabsf ); stdlib_base_minmaxabsf( x, y, &out[0], &out[1] ); return NULL; } -// cppcheck-suppress shadowFunction STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c index bc11d4a5b811..f6bf09eb5572 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c @@ -19,7 +19,6 @@ #include "stdlib/math/base/special/minmaxabsf.h" #include "stdlib/math/base/assert/is_nanf.h" #include "stdlib/math/base/special/absf.h" -// #include "stdlib/constants/float32/nan.h" /** * Evaluates the single-precision min and max value. @@ -34,13 +33,11 @@ * float min; * float max; * float v = stdlib_base_minmaxabsf( 3.2, 4.1, &min, &max ); -* // returns [ 3.2f, 4.1f ] * * @example * float min; * float max; * float v = stdlib_base_minmaxabsf( 4.0, 0.0/0.0, &min, &max ); -* // returns [ NaN, NaN ] */ void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ){ if ( stdlib_base_is_nanf( x ) || stdlib_base_is_nanf( y ) ) { From f092b66a33162338533ac110c590c7a6ab6b607b Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Thu, 27 Mar 2025 08:37:11 +0000 Subject: [PATCH 08/16] Resolve merge conflicts --- .../math/base/special/cbrtf/benchmark/c/native/benchmark.c | 2 +- .../math/base/special/gamma-lanczos-sum/benchmark/benchmark.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c index 46b4a5522f77..9fabb7990e4e 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c @@ -102,7 +102,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_cbrtf( x[ i%(sizeof(x)/sizeof(x[0])) ] ); + y = stdlib_base_cbrtf( x[ i%x.length ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js index 191fac9e22d2..c3f597245b9c 100644 --- a/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/gamma-lanczos-sum/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var gammaLanczosSum = require( './../lib' ); From 160318e34edc4985085ca619404a23b5c8307321 Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Fri, 28 Mar 2025 11:08:04 +0000 Subject: [PATCH 09/16] feat: fix manifest.json errors --- 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 --- --- .../@stdlib/math/base/special/minmaxabsf/manifest.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json index 591a3431fde8..7dd2b0ea08be 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json @@ -56,11 +56,6 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/napi/argv", - "@stdlib/napi/export", - "@stdlib/napi/argv-float", - "@stdlib/napi/argv-float32array", - "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ] @@ -76,11 +71,6 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/napi/argv", - "@stdlib/napi/export", - "@stdlib/napi/argv-float", - "@stdlib/napi/argv-float32array", - "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ] From eca6eed254a6531e2074dc06521fe7a2626a7893 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sun, 30 Mar 2025 10:45:15 +0000 Subject: [PATCH 10/16] fix: resolve lint errors --- .../@stdlib/math/base/special/minmaxabsf/README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index c6045565b798..237ba609fd19 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -241,14 +241,6 @@ int main(void) { @@ -259,12 +251,6 @@ int main(void) { -[@stdlib/math/base/special/maxabsf]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/maxabsf - -[@stdlib/math/base/special/minabsf]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/minabsf - -[@stdlib/math/base/special/minmaxabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/minmaxabs - From 883bae88d3b1b1a21e3c797ecc587e7b63e92c40 Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:22:30 +0000 Subject: [PATCH 11/16] feat: fixed copyright dates --- 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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/minmaxabsf/README.md | 2 +- .../math/base/special/minmaxabsf/benchmark/benchmark.js | 2 +- .../base/special/minmaxabsf/benchmark/c/native/Makefile | 2 +- .../special/minmaxabsf/benchmark/c/native/benchmark.c | 2 +- .../base/special/minmaxabsf/benchmark/julia/benchmark.jl | 2 +- .../@stdlib/math/base/special/minmaxabsf/binding.gyp | 2 +- .../math/base/special/minmaxabsf/docs/types/index.d.ts | 6 +++--- .../math/base/special/minmaxabsf/docs/types/test.ts | 8 ++++---- .../math/base/special/minmaxabsf/examples/c/Makefile | 2 +- .../math/base/special/minmaxabsf/examples/c/example.c | 2 +- .../math/base/special/minmaxabsf/examples/index.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/include.gypi | 2 +- .../include/stdlib/math/base/special/minmaxabsf.h | 2 +- .../@stdlib/math/base/special/minmaxabsf/lib/assign.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/lib/index.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/lib/main.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/lib/native.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/src/Makefile | 2 +- .../@stdlib/math/base/special/minmaxabsf/src/addon.c | 2 +- .../@stdlib/math/base/special/minmaxabsf/src/main.c | 2 +- .../math/base/special/minmaxabsf/test/test.assign.js | 2 +- .../@stdlib/math/base/special/minmaxabsf/test/test.js | 2 +- .../math/base/special/minmaxabsf/test/test.main.js | 2 +- .../math/base/special/minmaxabsf/test/test.native.js | 2 +- 24 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index 237ba609fd19..32d1ff69bd4f 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js index b936ecc0f1ea..fe9d43fed295 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile index f69e9da2b4d3..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c index 512b43bb2e51..52435d492c9b 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/c/native/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl index b78839e3f6fb..f31b86e02ce6 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl @@ -2,7 +2,7 @@ # # @license Apache-2.0 # -# Copyright (c) 2018 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp index ec3992233442..68a1ca11d160 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts index 1b4067a0427a..055e750d6df7 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. @@ -85,9 +85,9 @@ interface MinMaxAbsf { * var v = minmaxabsf( +0.0, -0.0 ); * // returns [ 0.0, 0.0 ] */ -declare var minmaxabsf: MinMaxAbsf; +declare const minmaxabsf: MinMaxAbsf; // EXPORTS // -export = minmaxabsf; +export default minmaxabsf; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts index b86d6f721c12..1a2994ed0a9b 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 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. @@ -16,7 +16,7 @@ * limitations under the License. */ -import float32Array from '@stdlib/array/float32'; +import float32Array = require( '@stdlib/array/float32' ); import minmaxabsf from './index'; @@ -24,7 +24,7 @@ import minmaxabsf from './index'; // The function returns an array of numbers... { - minmaxabsf( 3.0, -0.2 ); // $ExpectType number[] + minmaxabsf( 3.0, -0.2 ); } // The compiler throws an error if the function is provided an argument which is not a number... @@ -57,7 +57,7 @@ import minmaxabsf from './index'; { const out = new float32Array( 2 ); - minmaxabsf.assign( 3.0, -0.2, out, 1, 0 ); // $ExpectType Collection + minmaxabsf.assign( 3.0, -0.2, out, 1, 0 ); // $ExpectType Collection } // The compiler throws an error if the `assign` method is provided a first argument which is not a number... diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile index 6aed70daf167..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c index 7e9edbd58592..00c2745c44e7 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js index b3cfaa2c8ea5..aa02b4d7153f 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi index 575cb043c0bf..ecfaf82a3279 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h index 0522fbfa59a2..fc4a289278fb 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/include/stdlib/math/base/special/minmaxabsf.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js index 08524d193d4d..140666b577f7 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js index 0817a7bc3528..1b90f62b46da 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js index 701426ecc667..2b651aabd4d1 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js index 01e09ffa78c4..700355e834c1 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile index bcf18aa46655..7733b6180cb4 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c index 55a61bdc61ec..d7665eb9f041 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c index f6bf09eb5572..59d7cc4b29f4 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js index b77c77c98dc3..8ff8e1a2b819 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js index 461faf012a2d..8c959616b8dd 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2022 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js index c6fcd61c0691..c2f8a3ba59ef 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 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. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js index e0b71080758a..dd832f1d7869 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/test/test.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 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. From f24b5cc3a0749f5088b7bb0af907c6aa967d752b Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:31:54 +0000 Subject: [PATCH 12/16] feat: fix julia benchmark --- 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 --- --- .../math/base/special/minmaxabsf/benchmark/julia/benchmark.jl | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl old mode 100644 new mode 100755 index f31b86e02ce6..f07cf7408a2e --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl @@ -16,6 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import Pkg +Pkg.add("BenchmarkTools") import BenchmarkTools using Printf From a57e62935a2366c03f7ff92b49daa5880c75c385 Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:37:45 +0000 Subject: [PATCH 13/16] feat: fix julia benchmark --- 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 --- --- .../math/base/special/minmaxabsf/benchmark/julia/benchmark.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl index f07cf7408a2e..f31b86e02ce6 100755 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl @@ -16,8 +16,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import Pkg -Pkg.add("BenchmarkTools") import BenchmarkTools using Printf From 18d14d46d80acaa81f0bd9b52225de55be317b9c Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:44:41 +0000 Subject: [PATCH 14/16] feat: fix julia benchmark --- 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 --- --- .../minmaxabsf/benchmark/julia/benchmark.jl | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl index f31b86e02ce6..eba092d8880e 100755 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/benchmark/julia/benchmark.jl @@ -23,6 +23,28 @@ using Printf name = "minmaxabsf"; repeats = 3; +""" + minmaxabsf( x, y ) +Returns array of minimum and maximum absolute values + +# Arguments + +* `x`: First Number +* `y`: Second Number + +# Examples + +``` julia +julia> minmaxabsf( 3, 3 ) +``` +""" +function minmaxabsf( x, y ) + ax = abs(x) + ay = abs(y) + return ax < ay ? [ax, ay] : [ay, ax] +end + + """ print_version() From fd84128076b7dc7d87f8acf5747018df2c411c4e Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:26:22 +0000 Subject: [PATCH 15/16] feat: addressed review comments --- 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: passed - 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: passed - task: lint_c_examples status: passed - 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 --- --- .../math/base/special/minmaxabsf/README.md | 22 ++++++------------- .../special/minmaxabsf/examples/c/example.c | 4 ++-- .../base/special/minmaxabsf/examples/index.js | 16 +++++--------- .../math/base/special/minmaxabsf/src/addon.c | 6 ++--- .../math/base/special/minmaxabsf/src/main.c | 4 ++-- 5 files changed, 19 insertions(+), 33 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md index 32d1ff69bd4f..6ccb346823f3 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/README.md @@ -99,20 +99,14 @@ var bool = ( v === out ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var minmaxabsf = require( '@stdlib/math/base/special/minmaxabsf' ); -var x; -var y; -var v; -var i; +var x = uniform( 100, -50, 50); +var y = uniform( 100, -50, 50); -for ( i = 0; i < 100; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = ( randu()*100.0 ) - 50.0; - v = minmaxabsf( x, y ); - console.log( 'minmaxabsf(%d,%d) = [%d, %d]', x, y, v[0], v[1] ); -} +logEachMap( 'minmaxabsf(%f,%f) = [%s]', x, y, minmaxabsf ); ``` @@ -153,18 +147,16 @@ Returns the minimum and maximum absolute single-precision floating-point values float min; float max; stdlib_base_minmaxabsf( -4.2f, 3.14f, &min, &max ); -// [ 3.14, 4.2 ] stdlib_base_minmaxabsf( 0.0f, -0.0f, &min, &max ); -// [ 0.0, 0.0 ] ``` The function accepts the following arguments: - **x**: `[in] float` input value. - **y**: `[in] float` input value. -- **min**: `[in] *float` output min. -- **max**: `[in] *float` output max. +- **min**: `[out] *float` output min. +- **max**: `[out] *float` output max. ```c void stdlib_base_minmaxabsf( const float x, const float y, float* min, float* max ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c index 00c2745c44e7..381fbd3e628f 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/c/example.c @@ -16,9 +16,9 @@ * limitations under the License. */ -#include "stdlib/math/base/special/minmaxabsf.h" -#include #include +#include +#include "stdlib/math/base/special/minmaxabsf.h" int main( void ) { float x; diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js index aa02b4d7153f..877eb582f96e 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/examples/index.js @@ -18,17 +18,11 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var minmaxabsf = require( './../lib' ); -var x; -var y; -var v; -var i; +var x = uniform( 100, -50, 50 ); +var y = uniform( 100, -50, 50 ); -for ( i = 0; i < 100; i++ ) { - x = ( randu()*100.0 ) - 50.0; - y = ( randu()*100.0 ) - 50.0; - v = minmaxabsf( x, y ); - console.log( 'minmaxabs(%d,%d) = [%d, %d]', x, y, v[0], v[1] ); -} +logEachMap( 'minmaxabsf(%f,%f) = [%s]', x, y, minmaxabsf ); diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c index d7665eb9f041..c0ba7dcadccf 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/addon.c @@ -16,12 +16,12 @@ * limitations under the License. */ -#include "stdlib/math/base/special/minmaxabsf.h" +#include #include "stdlib/napi/argv.h" +#include "stdlib/napi/export.h" #include "stdlib/napi/argv_float.h" #include "stdlib/napi/argv_float32array.h" -#include "stdlib/napi/export.h" -#include +#include "stdlib/math/base/special/minmaxabsf.h" /** * Receives JavaScript callback invocation data. diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c index 59d7cc4b29f4..43a6c0f436b0 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/src/main.c @@ -16,9 +16,9 @@ * limitations under the License. */ -#include "stdlib/math/base/special/minmaxabsf.h" -#include "stdlib/math/base/assert/is_nanf.h" #include "stdlib/math/base/special/absf.h" +#include "stdlib/math/base/assert/is_nanf.h" +#include "stdlib/math/base/special/minmaxabsf.h" /** * Evaluates the single-precision min and max value. From 2c7567e312fe134003959b9f1a8602b3b36ce7d3 Mon Sep 17 00:00:00 2001 From: Sahil Goyal <87982509+sahil20021008@users.noreply.github.com> Date: Sat, 26 Apr 2025 11:47:41 +0000 Subject: [PATCH 16/16] feat: add implementation of stdlib/math/base/special/minmaxabsf --- 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 --- --- .../@stdlib/math/base/special/minmaxabsf/manifest.json | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json index 7dd2b0ea08be..d285503c1c6a 100644 --- a/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/minmaxabsf/manifest.json @@ -40,7 +40,6 @@ "@stdlib/napi/export", "@stdlib/napi/argv-float", "@stdlib/napi/argv-float32array", - "@stdlib/math/base/napi/quaternary", "@stdlib/math/base/special/absf", "@stdlib/math/base/assert/is-nanf" ]