From 10b24bff34388de5e879c9a3b3e51a7d5b9e611d Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sun, 3 Mar 2024 04:16:36 +0530 Subject: [PATCH 01/25] feat: Add C implementation for @stdlib/math/base/special/max --- .../@stdlib/math/base/special/max/README.md | 84 ++++++++- .../special/max/benchmark/benchmark.native.js | 62 +++++++ .../base/special/max/benchmark/c/Makefile | 107 ----------- .../special/max/benchmark/c/native/Makefile | 146 +++++++++++++++ .../max/benchmark/c/{ => native}/benchmark.c | 17 +- .../@stdlib/math/base/special/max/binding.gyp | 170 ++++++++++++++++++ .../math/base/special/max/examples/c/Makefile | 146 +++++++++++++++ .../base/special/max/examples/c/example.c | 34 ++++ .../math/base/special/max/include.gypi | 53 ++++++ .../include/stdlib/math/base/special/max.h | 38 ++++ .../math/base/special/max/lib/native.js | 59 ++++++ .../math/base/special/max/manifest.json | 78 ++++++++ .../math/base/special/max/src/Makefile | 70 ++++++++ .../math/base/special/max/src/addone.c | 22 +++ .../@stdlib/math/base/special/max/src/main.c | 56 ++++++ .../math/base/special/max/test/test.native.js | 100 +++++++++++ 16 files changed, 1126 insertions(+), 116 deletions(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js delete mode 100644 lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/Makefile rename lib/node_modules/@stdlib/math/base/special/max/benchmark/c/{ => native}/benchmark.c (91%) create mode 100644 lib/node_modules/@stdlib/math/base/special/max/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/max/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h create mode 100644 lib/node_modules/@stdlib/math/base/special/max/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/max/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/max/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/max/src/addone.c create mode 100644 lib/node_modules/@stdlib/math/base/special/max/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/max/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index 0224dc2e2fd8..e6d6d8bd7aa1 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +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. @@ -103,6 +103,88 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/max.h" +``` + +#### stdlib_base_max( x, y ) + +Returns the maximum value. + +```c +double out = stdlib_base_max( 4.2, 3.14 ); +// returns 4.2 + +out = stdlib_base_max( 0.0, -0.0 ); +// returns 0.0 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **y**: `[in] double` input value. + +```c +double stdlib_base_max( const double x, const double y ); +``` +
+ + +
+
+ + +
+### Examples +```c +#include "stdlib/math/base/special/max.h" +#include +#include +int main( void ) { + double x; + double y; + double v; + int i; + + for ( i = 0; i < 100; i++ ) { + x = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0; + y = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0; + v = stdlib_base_max( x, y ); + printf( "x: %lf, y: %lf, max(x, y): %lf\n", x, y, v ); + } +} +``` + +
+ + + +
+ + +
diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js new file mode 100644 index 000000000000..46372275289f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js @@ -0,0 +1,62 @@ +/** +* @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 bench = require( '@stdlib/bench' ); +var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var max = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( max instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var x; + var y; + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*200.0 ) - 100.0; + y = ( randu()*200.0 ) - 100.0; + z = max( x, y ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile deleted file mode 100644 index e4542b1e66e9..000000000000 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile +++ /dev/null @@ -1,107 +0,0 @@ -#/ -# @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. -#/ - - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -endif - -# Determine the OS: -# -# [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 -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]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# TARGETS # - -# Default target. -# -# This target is the default target. - -all: $(c_targets) - -.PHONY: all - - -# Compile C source. -# -# This target compiles C source files. - -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - - -# Run a benchmark. -# -# This target runs a benchmark. - -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - - -# Perform clean-up. -# -# This target removes generated files. - -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/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/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c similarity index 91% rename from lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c rename to lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c index f59bfa084053..e348de1da371 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -17,8 +17,9 @@ */ /** -* Benchmark `fmax`. +* Benchmark `max`. */ +#include "stdlib/math/base/special/max.h" #include #include #include @@ -93,17 +94,17 @@ double rand_double() { */ double benchmark() { double elapsed; + double t; double x; double y; double z; - double t; int i; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = ( 1000.0*rand_double() ) - 500.0; - z = fmax( x, y ); + x = ( 200.0*rand_double() ) - 100.0; + y = ( 200.0*rand_double() ) - 100.0; + z = stdlib_base_max( x, y ); if ( z != z ) { printf( "should not return NaN\n" ); break; @@ -128,10 +129,10 @@ int main( void ) { print_version(); for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); + printf( "# c::native::%s\n", NAME ); elapsed = benchmark(); print_results( elapsed ); printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/binding.gyp b/lib/node_modules/@stdlib/math/base/special/max/binding.gyp new file mode 100644 index 000000000000..507cb00291e7 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/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 +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile new file mode 100644 index 000000000000..d53ef397c77d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/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 \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c new file mode 100644 index 000000000000..2b75580e3c99 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c @@ -0,0 +1,34 @@ +/** +* @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/max.h" +#include + +int main( void ) { + double x; + double y; + double v; + int i; + + for ( i = 0; i < 100; i++ ) { + x = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0; + y = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0; + v = stdlib_base_max( x, y ); + printf( "x: %lf, y: %lf, max(x, y): %lf\n", x, y, v ); + } +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/include.gypi b/lib/node_modules/@stdlib/math/base/special/max/include.gypi new file mode 100644 index 000000000000..c6495fc1da3f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/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': [ + ' y ) { + return x; + } + return y; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/max/test/test.native.js new file mode 100644 index 000000000000..646b9e92539b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/test/test.native.js @@ -0,0 +1,100 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); +var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var max = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( max instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof max, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { + var v; + + v = max( NaN, 3.14 ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = max( 3.14, NaN ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + t.end(); +}); + +tape( 'the function returns `Infinity` if provided `Infinity`', opts, function test( t ) { + var v; + + v = max( PINF, 3.14 ); + t.strictEqual( v, PINF, 'returns infinity' ); + + v = max( 3.14, PINF ); + t.strictEqual( v, PINF, 'returns infinity' ); + + t.end(); +}); + +tape( 'the function returns a correctly signed zero', opts, function test( t ) { + var v; + + v = max( +0.0, -0.0 ); + t.strictEqual( isPositiveZero( v ), true, 'returns +0' ); + + v = max( -0.0, +0.0 ); + t.strictEqual( isPositiveZero( v ), true, 'returns +0' ); + + v = max( -0.0, -0.0 ); + t.strictEqual( isNegativeZero( v ), true, 'returns -0' ); + + v = max( +0.0, +0.0 ); + t.strictEqual( isPositiveZero( v ), true, 'returns +0' ); + + t.end(); +}); + +tape( 'the function returns the maximum value', opts, function test( t ) { + var v; + + v = max( 4.2, 3.14 ); + t.strictEqual( v, 4.2, 'returns max value' ); + + v = max( -4.2, 3.14 ); + t.strictEqual( v, 3.14, 'returns max value' ); + + t.end(); +}); From 3b136249bfd48a486f0519863e7e903ffed72468 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:08:14 +0530 Subject: [PATCH 02/25] Update README.md Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- .../@stdlib/math/base/special/max/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index e6d6d8bd7aa1..30dc1806b69e 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -149,17 +149,27 @@ The function accepts the following arguments: ```c double stdlib_base_max( const double x, const double y ); ``` +
+ + +
+
+ + +
+ ### Examples + ```c -#include "stdlib/math/base/special/max.h" +#include "stdlib/math/base/special/min.h" #include #include int main( void ) { From 558a5e8db5afb85cdb84079789a17c9ce332705c Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:13:17 +0530 Subject: [PATCH 03/25] Update README.md Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- lib/node_modules/@stdlib/math/base/special/max/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index 30dc1806b69e..df28ac5fa8c0 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -169,7 +169,7 @@ double stdlib_base_max( const double x, const double y ); ### Examples ```c -#include "stdlib/math/base/special/min.h" +#include "stdlib/math/base/special/max.h" #include #include int main( void ) { From ad7247776e1d3602d70bd7b956747505246936d4 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sun, 3 Mar 2024 14:47:00 +0530 Subject: [PATCH 04/25] fix: requested changes made for #1459 --- .../@stdlib/math/base/special/max/README.md | 10 ++ .../base/special/max/benchmark/c/Makefile | 146 +++++++++++++++++ .../base/special/max/benchmark/c/benchmark.c | 138 ++++++++++++++++ .../math/base/special/max/manifest.json | 152 +++++++++--------- 4 files changed, 370 insertions(+), 76 deletions(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index e6d6d8bd7aa1..ecb6b17dad86 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -149,15 +149,25 @@ The function accepts the following arguments: ```c double stdlib_base_max( const double x, const double y ); ``` +
+ + +
+
+ + +
+ ### Examples + ```c #include "stdlib/math/base/special/max.h" #include diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/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 := 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/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c new file mode 100644 index 000000000000..e348de1da371 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c @@ -0,0 +1,138 @@ +/** +* @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. +*/ + +/** +* Benchmark `max`. +*/ +#include "stdlib/math/base/special/max.h" +#include +#include +#include +#include +#include + +#define NAME "max" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Prints the TAP version. +*/ +void print_version() { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +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 +*/ +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 +*/ +double tic() { + 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 +*/ +double rand_double() { + int r = rand(); + return (double)r / ( (double)RAND_MAX + 1.0 ); +} + +/** +* Runs a benchmark. +* +* @return elapsed time in seconds +*/ +double benchmark() { + double elapsed; + double t; + double x; + double y; + double z; + int i; + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + x = ( 200.0*rand_double() ) - 100.0; + y = ( 200.0*rand_double() ) - 100.0; + z = stdlib_base_max( x, y ); + if ( z != z ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( z != z ) { + 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 ); +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/manifest.json b/lib/node_modules/@stdlib/math/base/special/max/manifest.json index 389cf8a63b7c..374b5de554a7 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/max/manifest.json @@ -1,78 +1,78 @@ { - "options": { - "task": "build" + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true }, - "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/math/base/napi/binary", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" - ] - } - ] - } \ No newline at end of file + { + "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/math/base/napi/binary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/constants/float64/ninf" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/constants/float64/ninf" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/constants/float64/ninf" + ] + } + ] +} \ No newline at end of file From 7ca99078b936095f473679ea89c5c54ba6eb06d2 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sun, 3 Mar 2024 14:57:58 +0530 Subject: [PATCH 05/25] fix: requested changes made for #1459 --- .../math/base/special/max/benchmark/c/benchmark.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c index e348de1da371..98ed4941769f 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c @@ -17,9 +17,9 @@ */ /** -* Benchmark `max`. +* Benchmark `fmax`. */ -#include "stdlib/math/base/special/max.h" + #include #include #include @@ -94,6 +94,7 @@ double rand_double() { */ double benchmark() { double elapsed; + double t; double x; double y; @@ -104,7 +105,7 @@ double benchmark() { for ( i = 0; i < ITERATIONS; i++ ) { x = ( 200.0*rand_double() ) - 100.0; y = ( 200.0*rand_double() ) - 100.0; - z = stdlib_base_max( x, y ); + z = fmax( x, y ); if ( z != z ) { printf( "should not return NaN\n" ); break; @@ -129,7 +130,7 @@ int main( void ) { print_version(); for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); + printf( "# c::%s\n", NAME ); elapsed = benchmark(); print_results( elapsed ); printf( "ok %d benchmark finished\n", i+1 ); From 215caf6b37f7cd817bec03125549c4a5f766333c Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sun, 3 Mar 2024 15:06:24 +0530 Subject: [PATCH 06/25] fix: requested changes made for #1459 --- .../base/special/max/benchmark/c/Makefile | 81 +++++-------------- 1 file changed, 21 insertions(+), 60 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile index f69e9da2b4d3..6bb27312ba8c 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile @@ -16,15 +16,14 @@ # limitations under the License. #/ + # VARIABLES # ifndef VERBOSE QUIET := @ -else - QUIET := endif -# Determine the OS ([1][1], [2][2]). +# Determine the OS: # # [1]: https://en.wikipedia.org/wiki/Uname#Examples # [2]: http://stackoverflow.com/a/27776822/2225624 @@ -37,10 +36,6 @@ ifneq (, $(findstring MSYS,$(OS))) else ifneq (, $(findstring CYGWIN,$(OS))) OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif endif endif endif @@ -59,7 +54,7 @@ CFLAGS ?= \ -Wall \ -pedantic -# Determine whether to generate position independent code ([1][1], [2][2]). +# Determine whether to generate [position independent code][1]: # # [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options # [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option @@ -69,78 +64,44 @@ 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 # +# TARGETS # -#/ -# Compiles source files. +# Default target. # -# @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 -#/ +# This target is the default target. + all: $(c_targets) .PHONY: all -#/ -# Compiles C source files. + +# Compile C source. # -# @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`) -#/ +# This target compiles C source files. + $(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm -#/ -# Runs compiled benchmarks. + +# Run a benchmark. # -# @example -# make run -#/ +# This target runs a benchmark. + run: $(c_targets) $(QUIET) ./$< .PHONY: run -#/ -# Removes generated files. + +# Perform clean-up. # -# @example -# make clean -#/ +# This target removes generated files. + clean: $(QUIET) -rm -f *.o *.out -.PHONY: clean +.PHONY: clean \ No newline at end of file From ec098db1f04d6a20178966a92bdd2ccec35efdd8 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 18:57:16 +0530 Subject: [PATCH 07/25] Update README.md Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- lib/node_modules/@stdlib/math/base/special/max/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index 96fc3aac4b8c..b81732fce1ac 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -164,8 +164,7 @@ double stdlib_base_max( const double x, const double y ); -
- +
### Examples @@ -173,6 +172,7 @@ double stdlib_base_max( const double x, const double y ); #include "stdlib/math/base/special/max.h" #include #include + int main( void ) { double x; double y; From 082e63c56bed448d1f53da7b53195fa75e2a8275 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 18:58:59 +0530 Subject: [PATCH 08/25] Update Makefile Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- .../@stdlib/math/base/special/max/benchmark/c/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile index 6bb27312ba8c..e4542b1e66e9 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# 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. @@ -104,4 +104,4 @@ run: $(c_targets) clean: $(QUIET) -rm -f *.o *.out -.PHONY: clean \ No newline at end of file +.PHONY: clean From 7eea6e583a84906e4af3152c414537874eb6d951 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 18:59:55 +0530 Subject: [PATCH 09/25] Rename addone.c to addon.c Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- .../@stdlib/math/base/special/max/src/{addone.c => addon.c} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename lib/node_modules/@stdlib/math/base/special/max/src/{addone.c => addon.c} (92%) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/addone.c b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c similarity index 92% rename from lib/node_modules/@stdlib/math/base/special/max/src/addone.c rename to lib/node_modules/@stdlib/math/base/special/max/src/addon.c index 5540526bf036..ee15c5a9beb1 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/addone.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c @@ -19,4 +19,4 @@ #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/napi/binary.h" -STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) \ No newline at end of file +STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) From 29c24e6715d1c25531c195cb58e3f9e647ba36c8 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> Date: Sun, 3 Mar 2024 19:00:48 +0530 Subject: [PATCH 10/25] Update main.c Signed-off-by: Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index c1d3c6ece28e..69bc536c1071 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -44,7 +44,7 @@ double stdlib_base_max( const double x, const double y ) { return STDLIB_CONSTANT_FLOAT64_PINF; } if( x == y && x == 0.0 ) { - if ( stdlib_base_is_positive_zero ( x ) ) { + if ( stdlib_base_is_positive_zero( x ) ) { return x; } return y; @@ -53,4 +53,4 @@ double stdlib_base_max( const double x, const double y ) { return x; } return y; -} \ No newline at end of file +} From 5b260f9901bdf38bf9827198fa44a187d68b67f1 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Tue, 5 Mar 2024 19:50:28 +0530 Subject: [PATCH 11/25] fix: add C implementation for @stdlib/math/base/assert/max --- .../math/base/special/max/benchmark/c/benchmark.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c index 98ed4941769f..f59bfa084053 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. @@ -19,7 +19,6 @@ /** * Benchmark `fmax`. */ - #include #include #include @@ -94,17 +93,16 @@ double rand_double() { */ double benchmark() { double elapsed; - - double t; double x; double y; double z; + double t; int i; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 200.0*rand_double() ) - 100.0; - y = ( 200.0*rand_double() ) - 100.0; + x = ( 1000.0*rand_double() ) - 500.0; + y = ( 1000.0*rand_double() ) - 500.0; z = fmax( x, y ); if ( z != z ) { printf( "should not return NaN\n" ); @@ -136,4 +134,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} \ No newline at end of file +} From d23210d9dbe18dcc23c12b9be3a4e38ad3938294 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Tue, 5 Mar 2024 19:53:55 +0530 Subject: [PATCH 12/25] fix: add C implementation for @stdlib/math/base/assert/max --- lib/node_modules/@stdlib/math/base/special/max/README.md | 2 +- .../@stdlib/math/base/special/max/benchmark/benchmark.native.js | 2 +- .../math/base/special/max/benchmark/c/native/benchmark.c | 2 +- lib/node_modules/@stdlib/math/base/special/max/binding.gyp | 2 +- .../@stdlib/math/base/special/max/examples/c/Makefile | 2 +- .../@stdlib/math/base/special/max/examples/c/example.c | 2 +- lib/node_modules/@stdlib/math/base/special/max/include.gypi | 2 +- .../base/special/max/include/stdlib/math/base/special/max.h | 2 +- lib/node_modules/@stdlib/math/base/special/max/lib/native.js | 2 +- lib/node_modules/@stdlib/math/base/special/max/manifest.json | 2 +- lib/node_modules/@stdlib/math/base/special/max/src/Makefile | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/README.md b/lib/node_modules/@stdlib/math/base/special/max/README.md index b81732fce1ac..d454eb31f672 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/README.md +++ b/lib/node_modules/@stdlib/math/base/special/max/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 The Stdlib Authors. +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. diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js index 46372275289f..14d4e921b2c6 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/benchmark.native.js @@ -59,4 +59,4 @@ bench( pkg+'::native', opts, function benchmark( b ) { } b.pass( 'benchmark finished' ); b.end(); -}); \ No newline at end of file +}); diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c index e348de1da371..5d24ee75ecb7 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c @@ -135,4 +135,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/binding.gyp b/lib/node_modules/@stdlib/math/base/special/max/binding.gyp index 507cb00291e7..ec3992233442 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/binding.gyp +++ b/lib/node_modules/@stdlib/math/base/special/max/binding.gyp @@ -167,4 +167,4 @@ ], # end actions }, # end target copy_addon ], # end targets -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile index d53ef397c77d..6aed70daf167 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/Makefile @@ -143,4 +143,4 @@ run: $(c_targets) clean: $(QUIET) -rm -f *.o *.out -.PHONY: clean \ No newline at end of file +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c index 2b75580e3c99..e18eb8cd8ce0 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c @@ -31,4 +31,4 @@ int main( void ) { v = stdlib_base_max( x, y ); printf( "x: %lf, y: %lf, max(x, y): %lf\n", x, y, v ); } -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/include.gypi b/lib/node_modules/@stdlib/math/base/special/max/include.gypi index c6495fc1da3f..575cb043c0bf 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/include.gypi +++ b/lib/node_modules/@stdlib/math/base/special/max/include.gypi @@ -50,4 +50,4 @@ ' Date: Tue, 5 Mar 2024 20:04:42 +0530 Subject: [PATCH 13/25] fix: add C implementation for @stdlib/math/base/assert/max --- .../@stdlib/math/base/special/max/benchmark/c/benchmark.c | 2 +- .../@stdlib/math/base/special/max/examples/c/example.c | 2 +- .../base/special/max/include/stdlib/math/base/special/max.h | 2 +- lib/node_modules/@stdlib/math/base/special/max/src/addon.c | 2 +- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c index f59bfa084053..7d67422d497c 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c @@ -134,4 +134,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c index e18eb8cd8ce0..2b75580e3c99 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c @@ -31,4 +31,4 @@ int main( void ) { v = stdlib_base_max( x, y ); printf( "x: %lf, y: %lf, max(x, y): %lf\n", x, y, v ); } -} +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h b/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h index c18a2e1a74a1..25c7b8ccabb0 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h +++ b/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h @@ -35,4 +35,4 @@ double stdlib_base_max( const double x, const double y ); } #endif -#endif // !STDLIB_MATH_BASE_SPECIAL_MAX_H +#endif // !STDLIB_MATH_BASE_SPECIAL_MAX_H \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/addon.c b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c index ee15c5a9beb1..5540526bf036 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c @@ -19,4 +19,4 @@ #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/napi/binary.h" -STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) +STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index 69bc536c1071..ca3daf11cc38 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -53,4 +53,4 @@ double stdlib_base_max( const double x, const double y ) { return x; } return y; -} +} \ No newline at end of file From 580d98db34d2e00811234372608dde9a50cd0fa2 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Tue, 5 Mar 2024 20:06:05 +0530 Subject: [PATCH 14/25] fix: add C implementation for @stdlib/math/base/assert/max --- .../math/base/special/max/benchmark/c/native/benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c index 5d24ee75ecb7..e348de1da371 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c @@ -135,4 +135,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} +} \ No newline at end of file From b2297da2cf212284dd8d33f428c7a94c4347dc82 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 17:25:10 +0530 Subject: [PATCH 15/25] fix: new line added at the end of each file --- .../@stdlib/math/base/special/max/benchmark/c/benchmark.c | 2 +- .../math/base/special/max/benchmark/c/native/benchmark.c | 2 +- .../@stdlib/math/base/special/max/examples/c/example.c | 3 ++- .../base/special/max/include/stdlib/math/base/special/max.h | 2 +- lib/node_modules/@stdlib/math/base/special/max/src/addon.c | 2 +- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c index 7d67422d497c..f59bfa084053 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/benchmark.c @@ -134,4 +134,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c index e348de1da371..5d24ee75ecb7 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/max/benchmark/c/native/benchmark.c @@ -135,4 +135,4 @@ int main( void ) { printf( "ok %d benchmark finished\n", i+1 ); } print_summary( REPEATS, REPEATS ); -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c index 2b75580e3c99..66d78de8a566 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c @@ -18,6 +18,7 @@ #include "stdlib/math/base/special/max.h" #include +#include int main( void ) { double x; @@ -31,4 +32,4 @@ int main( void ) { v = stdlib_base_max( x, y ); printf( "x: %lf, y: %lf, max(x, y): %lf\n", x, y, v ); } -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h b/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h index 25c7b8ccabb0..c18a2e1a74a1 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h +++ b/lib/node_modules/@stdlib/math/base/special/max/include/stdlib/math/base/special/max.h @@ -35,4 +35,4 @@ double stdlib_base_max( const double x, const double y ); } #endif -#endif // !STDLIB_MATH_BASE_SPECIAL_MAX_H \ No newline at end of file +#endif // !STDLIB_MATH_BASE_SPECIAL_MAX_H diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/addon.c b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c index 5540526bf036..ee15c5a9beb1 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/addon.c @@ -19,4 +19,4 @@ #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/napi/binary.h" -STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) \ No newline at end of file +STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_max ) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index ca3daf11cc38..69bc536c1071 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -53,4 +53,4 @@ double stdlib_base_max( const double x, const double y ) { return x; } return y; -} \ No newline at end of file +} From 38b22bf43ef0a2dbfbcdb3efa42d3ad6dd141f67 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 17:31:00 +0530 Subject: [PATCH 16/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index 69bc536c1071..6139b0e4d83a 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "stdlib.h" #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/assert/is_nan.h" #include "stdlib/math/base/assert/is_negative_zero.h" @@ -30,11 +31,11 @@ * * @example * double v = max( 3.14, 4.2 ); -* // returns 3.14 +* // returns 4.2 * * @example * double v = max( 0.0, -0.0 ); -* // returns -0.0 +* // returns 0.0 */ double stdlib_base_max( const double x, const double y ) { if ( stdlib_base_is_nan( x ) || stdlib_base_is_nan( y ) ) { From 6edc1857e3b4cec07ad181286cd0c39931649a50 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 17:41:15 +0530 Subject: [PATCH 17/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index 6139b0e4d83a..06255c4a3c89 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -16,10 +16,9 @@ * limitations under the License. */ -#include "stdlib.h" #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/assert/is_nan.h" -#include "stdlib/math/base/assert/is_negative_zero.h" +#include "stdlib/math/base/assert/is_positive_zero.h" #include "stdlib/constants/float64/pinf.h" /** From 6ffaa624f8a95e701bb98ebbbcdf49387e1ceb93 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 17:42:55 +0530 Subject: [PATCH 18/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index 06255c4a3c89..a2754f5a0f51 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -18,7 +18,7 @@ #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/assert/is_nan.h" -#include "stdlib/math/base/assert/is_positive_zero.h" +#include "stdlib/math/base/assert/is_negative_zero.h" #include "stdlib/constants/float64/pinf.h" /** @@ -44,10 +44,10 @@ double stdlib_base_max( const double x, const double y ) { return STDLIB_CONSTANT_FLOAT64_PINF; } if( x == y && x == 0.0 ) { - if ( stdlib_base_is_positive_zero( x ) ) { - return x; + if ( stdlib_base_is_negative_zero( x ) ) { + return y; } - return y; + return x; } if ( x > y ) { return x; From 35477784ca097193811bc3dbecb73d7c3f6a3155 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 17:58:13 +0530 Subject: [PATCH 19/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index a2754f5a0f51..06255c4a3c89 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -18,7 +18,7 @@ #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/assert/is_nan.h" -#include "stdlib/math/base/assert/is_negative_zero.h" +#include "stdlib/math/base/assert/is_positive_zero.h" #include "stdlib/constants/float64/pinf.h" /** @@ -44,10 +44,10 @@ double stdlib_base_max( const double x, const double y ) { return STDLIB_CONSTANT_FLOAT64_PINF; } if( x == y && x == 0.0 ) { - if ( stdlib_base_is_negative_zero( x ) ) { - return y; + if ( stdlib_base_is_positive_zero( x ) ) { + return x; } - return x; + return y; } if ( x > y ) { return x; From 8cb91f2c29524a661253aa69061ca5bbd1b68090 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 18:04:14 +0530 Subject: [PATCH 20/25] fix: new line added at the end of each file --- .../@stdlib/math/base/special/max/examples/c/example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c index 66d78de8a566..bf4cb46b3767 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/max/examples/c/example.c @@ -17,8 +17,8 @@ */ #include "stdlib/math/base/special/max.h" -#include #include +#include int main( void ) { double x; From 0c9382d7b4639e6048b03f0dfbe69aa8b02cf586 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 20:54:24 +0530 Subject: [PATCH 21/25] fix: new line added at the end of each file --- .../@stdlib/math/base/special/max/manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/manifest.json b/lib/node_modules/@stdlib/math/base/special/max/manifest.json index 324b6bdf5b9e..61d0c64fef11 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/max/manifest.json @@ -39,7 +39,7 @@ "@stdlib/math/base/napi/binary", "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" + "@stdlib/constants/float64/pinf" ] }, { @@ -55,7 +55,7 @@ "dependencies": [ "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" + "@stdlib/constants/float64/pinf" ] }, { @@ -71,7 +71,7 @@ "dependencies": [ "@stdlib/math/base/assert/is-nan", "@stdlib/math/base/assert/is-negative-zero", - "@stdlib/constants/float64/ninf" + "@stdlib/constants/float64/pinf" ] } ] From 874cf696a4f593cf31e4bea143d759deebcb4a78 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 20:54:54 +0530 Subject: [PATCH 22/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/manifest.json b/lib/node_modules/@stdlib/math/base/special/max/manifest.json index 61d0c64fef11..6a3028d8ceb4 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/max/manifest.json @@ -38,7 +38,7 @@ "dependencies": [ "@stdlib/math/base/napi/binary", "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/math/base/assert/is-positive-zero", "@stdlib/constants/float64/pinf" ] }, From d01fa730484377a3b1c607e5254b8257b24ce5a1 Mon Sep 17 00:00:00 2001 From: Shashankss1205 Date: Sat, 9 Mar 2024 20:55:34 +0530 Subject: [PATCH 23/25] fix: new line added at the end of each file --- lib/node_modules/@stdlib/math/base/special/max/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/manifest.json b/lib/node_modules/@stdlib/math/base/special/max/manifest.json index 6a3028d8ceb4..97a89b1debb4 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/max/manifest.json @@ -54,7 +54,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/math/base/assert/is-positive-zero", "@stdlib/constants/float64/pinf" ] }, @@ -70,7 +70,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/assert/is-negative-zero", + "@stdlib/math/base/assert/is-positive-zero", "@stdlib/constants/float64/pinf" ] } From d90b327f930d91d69db4a2bf29b9880cf7c2ccfc Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 9 Mar 2024 19:20:56 -0500 Subject: [PATCH 24/25] Update lib/node_modules/@stdlib/math/base/special/max/src/main.c Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index 06255c4a3c89..e9b22719459b 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -43,7 +43,7 @@ double stdlib_base_max( const double x, const double y ) { if ( x == STDLIB_CONSTANT_FLOAT64_PINF || y == STDLIB_CONSTANT_FLOAT64_PINF ) { return STDLIB_CONSTANT_FLOAT64_PINF; } - if( x == y && x == 0.0 ) { + if ( x == y && x == 0.0 ) { if ( stdlib_base_is_positive_zero( x ) ) { return x; } From dfd9a22146c90c5d47436fd17e8070abdea4ff8f Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 9 Mar 2024 19:23:10 -0500 Subject: [PATCH 25/25] Update lib/node_modules/@stdlib/math/base/special/max/src/main.c Signed-off-by: Philipp Burckhardt --- lib/node_modules/@stdlib/math/base/special/max/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/max/src/main.c b/lib/node_modules/@stdlib/math/base/special/max/src/main.c index e9b22719459b..fac2edf94f5c 100644 --- a/lib/node_modules/@stdlib/math/base/special/max/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/max/src/main.c @@ -22,7 +22,7 @@ #include "stdlib/constants/float64/pinf.h" /** -* Return the maximum value. +* Returns the maximum value. * * @param x first number * @param y second number