From e3817a5d380848b4f2433a56811c43f84db661d2 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 09:51:57 +0530
Subject: [PATCH 01/16] feat: basic setup
---
.../math/base/special/cfloorf/README.md | 242 ++++++++++++++++++
.../math/base/special/cfloorf/binding.gyp | 170 ++++++++++++
.../math/base/special/cfloorf/include.gypi | 53 ++++
.../math/base/special/cfloorf/manifest.json | 78 ++++++
.../math/base/special/cfloorf/package.json | 70 +++++
5 files changed, 613 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/manifest.json
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/package.json
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
new file mode 100644
index 000000000000..1e303a9e186d
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
@@ -0,0 +1,242 @@
+
+
+# Floor
+
+> Round a single-precision complex floating-point number toward negative infinity.
+
+
+
+## Usage
+
+```javascript
+var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+```
+
+#### cfloorf( z )
+
+Rounds a single-precision complex floating-point number toward negative infinity.
+
+```javascript
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var real = require( '@stdlib/complex/float32/real' );
+var imag = require( '@stdlib/complex/float32/imag' );
+
+var v = cfloorf( new Complex64( -4.2, 5.5 ) );
+// returns
+
+var re = real( v );
+// returns -5.0
+
+var im = imag( v );
+// returns 5.0
+
+v = cfloorf( new Complex64( 9.99999, 0.1 ) );
+// returns
+
+re = real( v );
+// returns 9.0
+
+im = imag( v );
+// returns 0.0
+
+v = cfloorf( new Complex64( 0.0, 0.0 ) );
+// returns
+
+re = real( v );
+// returns 0.0
+
+im = imag( v );
+// returns 0.0
+
+v = cfloorf( new Complex64( NaN, NaN ) );
+// returns
+
+re = real( v );
+// returns NaN
+
+im = imag( v );
+// returns NaN
+```
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var randu = require( '@stdlib/random/base/randu' );
+var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+
+var re;
+var im;
+var z;
+var w;
+var i;
+
+for ( i = 0; i < 100; i++ ) {
+ re = ( randu()*100.0 ) - 50.0;
+ im = ( randu()*100.0 ) - 50.0;
+ z = new Complex64( re, im );
+ w = cfloorf( z );
+ console.log( 'cfloorf(%s) = %s', z.toString(), w.toString() );
+}
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/math/base/special/cfloorf.h"
+```
+
+#### stdlib_base_cfloorf( z )
+
+Rounds a single-precision complex floating-point number toward negative infinity.
+
+```c
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/complex/float32/real.h"
+#include "stdlib/complex/float32/imag.h"
+
+stdlib_complex64_t z = stdlib_complex64( 2.5f, -1.5f );
+
+stdlib_complex64_t out = stdlib_base_cfloorf( z );
+
+float re = stdlib_complex64_real( out );
+// returns 2.0f
+
+float im = stdlib_complex64_imag( out );
+// returns -2.0f
+```
+
+The function accepts the following arguments:
+
+- **z**: `[in] stdlib_complex64_t` input value.
+
+```c
+stdlib_complex64_t stdlib_base_cfloorf( const stdlib_complex64_t z );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/math/base/special/cfloorf.h"
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/complex/float32/reim.h"
+#include
+
+int main( void ) {
+ const stdlib_complex64_t x[] = {
+ stdlib_complex128( 3.14f, 1.5f ),
+ stdlib_complex128( -3.14f, -1.5f ),
+ stdlib_complex128( 0.0f, 0.0f ),
+ stdlib_complex128( 0.0f/0.0f, 0.0f/0.0f )
+ };
+
+ stdlib_complex64_t v;
+ stdlib_complex64_t y;
+ float re1;
+ float im1;
+ float re2;
+ float im2;
+ int i;
+ for ( i = 0; i < 4; i++ ) {
+ v = x[ i ];
+ y = stdlib_base_cfloorf( v );
+ stdlib_complex64_reim( v, &re1, &im1 );
+ stdlib_complex64_reim( y, &re2, &im2 );
+ printf( "cfloorf(%f + %fi) = %f + %fi\n", re1, im1, re2, im2 );
+ }
+}
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp b/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
new file mode 100644
index 000000000000..f2b466aef5c4
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
@@ -0,0 +1,170 @@
+# @license Apache-2.0
+#
+# Copyright (c) 2023 The Stdlib Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A `.gyp` file for building a Node.js native add-on.
+#
+# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
+# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
+{
+ # List of files to include in this file:
+ 'includes': [
+ './include.gypi',
+ ],
+
+ # Define variables to be used throughout the configuration for all targets:
+ 'variables': {
+ # Target name should match the add-on export name:
+ 'addon_target_name%': 'addon',
+
+ # Set variables based on the host OS:
+ 'conditions': [
+ [
+ 'OS=="win"',
+ {
+ # Define the object file suffix:
+ 'obj': 'obj',
+ },
+ {
+ # Define the object file suffix:
+ 'obj': 'o',
+ }
+ ], # end condition (OS=="win")
+ ], # end conditions
+ }, # end variables
+
+ # Define compile targets:
+ 'targets': [
+
+ # Target to generate an add-on:
+ {
+ # The target name should match the add-on export name:
+ 'target_name': '<(addon_target_name)',
+
+ # Define dependencies:
+ 'dependencies': [],
+
+ # Define directories which contain relevant include headers:
+ 'include_dirs': [
+ # Local include directory:
+ '<@(include_dirs)',
+ ],
+
+ # List of source files:
+ 'sources': [
+ '<@(src_files)',
+ ],
+
+ # Settings which should be applied when a target's object files are used as linker input:
+ 'link_settings': {
+ # Define libraries:
+ 'libraries': [
+ '<@(libraries)',
+ ],
+
+ # Define library directories:
+ 'library_dirs': [
+ '<@(library_dirs)',
+ ],
+ },
+
+ # C/C++ compiler flags:
+ 'cflags': [
+ # Enable commonly used warning options:
+ '-Wall',
+
+ # Aggressive optimization:
+ '-O3',
+ ],
+
+ # C specific compiler flags:
+ 'cflags_c': [
+ # Specify the C standard to which a program is expected to conform:
+ '-std=c99',
+ ],
+
+ # C++ specific compiler flags:
+ 'cflags_cpp': [
+ # Specify the C++ standard to which a program is expected to conform:
+ '-std=c++11',
+ ],
+
+ # Linker flags:
+ 'ldflags': [],
+
+ # Apply conditions based on the host OS:
+ 'conditions': [
+ [
+ 'OS=="mac"',
+ {
+ # Linker flags:
+ 'ldflags': [
+ '-undefined dynamic_lookup',
+ '-Wl,-no-pie',
+ '-Wl,-search_paths_first',
+ ],
+ },
+ ], # end condition (OS=="mac")
+ [
+ 'OS!="win"',
+ {
+ # C/C++ flags:
+ 'cflags': [
+ # Generate platform-independent code:
+ '-fPIC',
+ ],
+ },
+ ], # end condition (OS!="win")
+ ], # end conditions
+ }, # end target <(addon_target_name)
+
+ # Target to copy a generated add-on to a standard location:
+ {
+ 'target_name': 'copy_addon',
+
+ # Declare that the output of this target is not linked:
+ 'type': 'none',
+
+ # Define dependencies:
+ 'dependencies': [
+ # Require that the add-on be generated before building this target:
+ '<(addon_target_name)',
+ ],
+
+ # Define a list of actions:
+ 'actions': [
+ {
+ 'action_name': 'copy_addon',
+ 'message': 'Copying addon...',
+
+ # Explicitly list the inputs in the command-line invocation below:
+ 'inputs': [],
+
+ # Declare the expected outputs:
+ 'outputs': [
+ '<(addon_output_dir)/<(addon_target_name).node',
+ ],
+
+ # Define the command-line invocation:
+ 'action': [
+ 'cp',
+ '<(PRODUCT_DIR)/<(addon_target_name).node',
+ '<(addon_output_dir)/<(addon_target_name).node',
+ ],
+ },
+ ], # end actions
+ }, # end target copy_addon
+ ], # end targets
+}
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi b/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
new file mode 100644
index 000000000000..78db9faf8c74
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
@@ -0,0 +1,53 @@
+# @license Apache-2.0
+#
+# Copyright (c) 2023 The Stdlib Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A GYP include file for building a Node.js native add-on.
+#
+# Main documentation:
+#
+# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
+# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
+{
+ # Define variables to be used throughout the configuration for all targets:
+ 'variables': {
+ # Source directory:
+ 'src_dir': './src',
+
+ # Include directories:
+ 'include_dirs': [
+ '=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdmath",
+ "mathematics",
+ "math",
+ "math.floor",
+ "floor",
+ "cfloor",
+ "round",
+ "integer",
+ "nearest",
+ "value",
+ "complex",
+ "cmplx",
+ "number"
+ ]
+}
From 8c413d847487becc3e7b0fadac0c1544ec39d6ec Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 09:58:07 +0530
Subject: [PATCH 02/16] feat: c files added
---
.../stdlib/math/base/special/cfloorf.h | 40 +++++++++++
.../math/base/special/cfloorf/src/Makefile | 70 +++++++++++++++++++
.../math/base/special/cfloorf/src/addon.c | 23 ++++++
.../math/base/special/cfloorf/src/main.c | 54 ++++++++++++++
4 files changed, 187 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/include/stdlib/math/base/special/cfloorf.h
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/src/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/src/addon.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/src/main.c
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/include/stdlib/math/base/special/cfloorf.h b/lib/node_modules/@stdlib/math/base/special/cfloorf/include/stdlib/math/base/special/cfloorf.h
new file mode 100644
index 000000000000..af824d0b33df
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/include/stdlib/math/base/special/cfloorf.h
@@ -0,0 +1,40 @@
+/**
+* @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.
+*/
+
+#ifndef STDLIB_MATH_BASE_SPECIAL_CFLOORF_H
+#define STDLIB_MATH_BASE_SPECIAL_CFLOORF_H
+
+#include "stdlib/complex/float32/ctor.h"
+
+/*
+* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* Rounds a single-precision complex floating-point number toward negative infinity.
+*/
+stdlib_complex64_t stdlib_base_cfloorf( const stdlib_complex64_t z );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // !STDLIB_MATH_BASE_SPECIAL_CFLOORF_H
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/src/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/src/Makefile
new file mode 100644
index 000000000000..bcf18aa46655
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/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/cfloorf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/src/addon.c
new file mode 100644
index 000000000000..03c8051b067a
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/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/cfloorf.h"
+#include "stdlib/math/base/napi/unary.h"
+
+// cppcheck-suppress shadowFunction
+STDLIB_MATH_BASE_NAPI_MODULE_C_C( stdlib_base_cfloorf )
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/src/main.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/src/main.c
new file mode 100644
index 000000000000..ee1269a06eaf
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/src/main.c
@@ -0,0 +1,54 @@
+/**
+* @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/cfloorf.h"
+#include "stdlib/math/base/special/floorf.h"
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/complex/float32/reim.h"
+
+/**
+* Rounds a single-precision complex floating-point number toward negative infinity.
+*
+* @param z input value
+* @return result
+*
+* @example
+* #include "stdlib/complex/float32/ctor.h"
+* #include "stdlib/complex/float32/real.h"
+* #include "stdlib/complex/float32/imag.h"
+*
+* stdlib_complex64_t z = stdlib_complex64( 3.5f, -2.5f );
+*
+* stdlib_complex64_t out = stdlib_base_cfloorf( z );
+*
+* float re = stdlib_complex64_real( out );
+* // returns 3.0f
+*
+* float im = stdlib_complex64_imag( out );
+* // returns -3.0f
+*/
+stdlib_complex64_t stdlib_base_cfloorf( const stdlib_complex64_t z ) {
+ float re;
+ float im;
+
+ stdlib_complex64_reim( z, &re, &im );
+
+ re = stdlib_base_floorf( re );
+ im = stdlib_base_floorf( im );
+ return stdlib_complex64( re, im );
+}
From 20c9317d4097215123a19042a73d47d4ba87ecf8 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:12:06 +0530
Subject: [PATCH 03/16] feat: js files added
---
.../math/base/special/cfloorf/lib/index.js | 94 ++++++++++++++++
.../math/base/special/cfloorf/lib/main.js | 100 ++++++++++++++++++
.../math/base/special/cfloorf/lib/native.js | 58 ++++++++++
3 files changed, 252 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/lib/main.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/lib/native.js
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
new file mode 100644
index 000000000000..af44bd447f27
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
@@ -0,0 +1,94 @@
+/**
+* @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';
+
+/**
+* Round a single-precision floating-point complex number toward negative infinity.
+*
+* @module @stdlib/math/base/special/cfloorf
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+* var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+*
+* var v = cfloorf( new Complex64( -4.2, 5.5 ) );
+* // returns
+*
+* var re = real( v );
+* // returns -5.0
+*
+* var im = imag( v );
+* // returns 5.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+* var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+*
+* var v = cfloorf( new Complex64( 9.99999, 0.1 ) );
+* // returns
+*
+* var re = real( v );
+* // returns 9.0
+*
+* var im = imag( v );
+* // returns 0.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+* var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+*
+* var v = cfloorf( new Complex64( 0.0, 0.0 ) );
+* // returns
+*
+* var re = real( v );
+* // returns 0.0
+*
+* var im = imag( v );
+* // returns 0.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+* var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
+*
+* var v = cfloorf( new Complex64( NaN, NaN ) );
+* // returns
+*
+* var re = real( v );
+* // returns NaN
+*
+* var im = imag( v );
+* // returns NaN
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/main.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/main.js
new file mode 100644
index 000000000000..f295aeccdf3f
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/main.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 Complex64 = require( '@stdlib/complex/float32/ctor' );
+var floorf = require( '@stdlib/math/base/special/floorf' );
+var real = require( '@stdlib/complex/float32/real' );
+var imag = require( '@stdlib/complex/float32/imag' );
+
+
+// MAIN //
+
+/**
+* Rounds a single-precision floating-point complex number toward negative infinity.
+*
+* @param {Complex64} z - complex number
+* @returns {Complex64} result
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( -4.2, 5.5 ) );
+* // returns
+*
+* var re = real( v );
+* // returns -5.0
+*
+* var im = imag( v );
+* // returns 5.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( 9.99999, 0.1 ) );
+* // returns
+*
+* var re = real( v );
+* // returns 9.0
+*
+* var im = imag( v );
+* // returns 0.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( 0.0, 0.0 ) );
+* // returns
+*
+* var re = real( v );
+* // returns 0.0
+*
+* var im = imag( v );
+* // returns 0.0
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( NaN, NaN ) );
+* // returns
+*
+* var re = real( v );
+* // returns NaN
+*
+* var im = imag( v );
+* // returns NaN
+*/
+function cfloorf( z ) {
+ return new Complex64( floorf( real( z ) ), floorf( imag( z ) ) );
+}
+
+
+// EXPORTS //
+
+module.exports = cfloorf;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/native.js
new file mode 100644
index 000000000000..e60ed146e267
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/native.js
@@ -0,0 +1,58 @@
+/**
+* @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 Complex64 = require( '@stdlib/complex/float32/ctor' );
+var addon = require( './../src/addon.node' );
+
+
+// MAIN //
+
+/**
+* Rounds a single-precision floating-point complex number toward negative infinity.
+*
+* @private
+* @param {Complex64} z - complex number
+* @returns {Complex64} result
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( -1.5, 2.5 ) );
+* // returns
+*
+* var re = real( v );
+* // returns -2.0
+*
+* var im = imag( v );
+* // returns 2.0
+*/
+function cfloorf( z ) {
+ var v = addon( z );
+ return new Complex64( v.re, v.im );
+}
+
+
+// EXPORTS //
+
+module.exports = cfloorf;
From 6d5085818269925f51ac5290dc9b17de6351aaef Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:28:32 +0530
Subject: [PATCH 04/16] feat: tests added
---
.../math/base/special/cfloorf/test/test.js | 109 ++++++++++++++++
.../base/special/cfloorf/test/test.native.js | 118 ++++++++++++++++++
2 files changed, 227 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.native.js
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.js
new file mode 100644
index 000000000000..76e1a0714d3d
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.js
@@ -0,0 +1,109 @@
+/**
+* @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 PINF = require( '@stdlib/constants/float32/pinf' );
+var NINF = require( '@stdlib/constants/float32/ninf' );
+var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
+var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
+var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var real = require( '@stdlib/complex/float32/real' );
+var imag = require( '@stdlib/complex/float32/imag' );
+var cfloorf = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof cfloorf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function rounds real and imaginary components to the largest integer smaller than or equal to a given number', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( -4.2, 5.5 ) );
+ t.strictEqual( real( v ), -5.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 5.0, 'returns expected value' );
+
+ v = cfloorf( new Complex64( 9.99999, 0.1 ) );
+ t.strictEqual( real( v ), 9.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 0.0, 'returns expected value' );
+
+ v = cfloorf( new Complex64( 0.0, 0.0 ) );
+ t.strictEqual( real( v ), 0.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 0.0, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a `NaN` if provided a `NaN`', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( NaN, NaN ) );
+ t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `-0` if provided `-0`', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( -0.0, -0.0 ) );
+ t.strictEqual( isNegativeZerof( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isNegativeZerof( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `+0` if provided `+0`', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( +0.0, +0.0 ) );
+ t.strictEqual( isPositiveZerof( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isPositiveZerof( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `+infinity` if provided `+infinity`', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( PINF, PINF ) );
+ t.strictEqual( real( v ), PINF, 'returns expected value' );
+ t.strictEqual( imag( v ), PINF, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `-infinity` if provided `-infinity`', function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( NINF, NINF ) );
+ t.strictEqual( real( v ), NINF, 'returns expected value' );
+ t.strictEqual( imag( v ), NINF, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.native.js
new file mode 100644
index 000000000000..4d59afd8e683
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/test/test.native.js
@@ -0,0 +1,118 @@
+/**
+* @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 PINF = require( '@stdlib/constants/float32/pinf' );
+var NINF = require( '@stdlib/constants/float32/ninf' );
+var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
+var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
+var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var real = require( '@stdlib/complex/float32/real' );
+var imag = require( '@stdlib/complex/float32/imag' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+
+
+// VARIABLES //
+
+var cfloorf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
+var opts = {
+ 'skip': ( cfloorf instanceof Error )
+};
+
+
+// TESTS //
+
+tape( 'main export is a function', opts, function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof cfloorf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function rounds real and imaginary components to the largest integer smaller than or equal to a given number', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( -4.2, 5.5 ) );
+ t.strictEqual( real( v ), -5.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 5.0, 'returns expected value' );
+
+ v = cfloorf( new Complex64( 9.99999, 0.1 ) );
+ t.strictEqual( real( v ), 9.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 0.0, 'returns expected value' );
+
+ v = cfloorf( new Complex64( 0.0, 0.0 ) );
+ t.strictEqual( real( v ), 0.0, 'returns expected value' );
+ t.strictEqual( imag( v ), 0.0, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a `NaN` if provided a `NaN`', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( NaN, NaN ) );
+ t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( -0.0, -0.0 ) );
+ t.strictEqual( isNegativeZerof( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isNegativeZerof( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `+0` if provided `+0`', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( +0.0, +0.0 ) );
+ t.strictEqual( isPositiveZerof( real( v ) ), true, 'returns expected value' );
+ t.strictEqual( isPositiveZerof( imag( v ) ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `+infinity` if provided `+infinity`', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( PINF, PINF ) );
+ t.strictEqual( real( v ), PINF, 'returns expected value' );
+ t.strictEqual( imag( v ), PINF, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns `-infinity` if provided `-infinity`', opts, function test( t ) {
+ var v;
+
+ v = cfloorf( new Complex64( NINF, NINF ) );
+ t.strictEqual( real( v ), NINF, 'returns expected value' );
+ t.strictEqual( imag( v ), NINF, 'returns expected value' );
+
+ t.end();
+});
From 7803e7a8a0f78f9274ff9e6fee3313a9eb68bad4 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:33:18 +0530
Subject: [PATCH 05/16] feat: examples added
---
.../base/special/cfloorf/examples/c/Makefile | 146 ++++++++++++++++++
.../base/special/cfloorf/examples/c/example.c | 46 ++++++
.../base/special/cfloorf/examples/index.js | 37 +++++
3 files changed, 229 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
new file mode 100644
index 000000000000..f0ae66fecf01
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
@@ -0,0 +1,146 @@
+#/
+# @license Apache-2.0
+#
+# Copyright (c) 2023 The Stdlib Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#/
+
+# VARIABLES #
+
+ifndef VERBOSE
+ QUIET := @
+else
+ QUIET :=
+endif
+
+# Determine the OS ([1][1], [2][2]).
+#
+# [1]: https://en.wikipedia.org/wiki/Uname#Examples
+# [2]: http://stackoverflow.com/a/27776822/2225624
+OS ?= $(shell uname)
+ifneq (, $(findstring MINGW,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring MSYS,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring CYGWIN,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring Windows_NT,$(OS)))
+ OS := WINNT
+endif
+endif
+endif
+endif
+
+# Define the program used for compiling C source files:
+ifdef C_COMPILER
+ CC := $(C_COMPILER)
+else
+ CC := gcc
+endif
+
+# Define the command-line options when compiling C files:
+CFLAGS ?= \
+ -std=c99 \
+ -O3 \
+ -Wall \
+ -pedantic
+
+# Determine whether to generate position independent code ([1][1], [2][2]).
+#
+# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
+# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
+ifeq ($(OS), WINNT)
+ fPIC ?=
+else
+ fPIC ?= -fPIC
+endif
+
+# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
+INCLUDE ?=
+
+# List of source files:
+SOURCE_FILES ?=
+
+# List of libraries (e.g., `-lopenblas -lpthread`):
+LIBRARIES ?=
+
+# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
+LIBPATH ?=
+
+# List of C targets:
+c_targets := example.out
+
+
+# RULES #
+
+#/
+# Compiles source files.
+#
+# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
+# @param {string} [CFLAGS] - C compiler options
+# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
+# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
+# @param {string} [SOURCE_FILES] - list of source files
+# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
+# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
+#
+# @example
+# make
+#
+# @example
+# make all
+#/
+all: $(c_targets)
+
+.PHONY: all
+
+#/
+# Compiles C source files.
+#
+# @private
+# @param {string} CC - C compiler (e.g., `gcc`)
+# @param {string} CFLAGS - C compiler options
+# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
+# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
+# @param {string} SOURCE_FILES - list of source files
+# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
+# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
+#/
+$(c_targets): %.out: %.c
+ $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
+
+#/
+# Runs compiled examples.
+#
+# @example
+# make run
+#/
+run: $(c_targets)
+ $(QUIET) ./$<
+
+.PHONY: run
+
+#/
+# Removes generated files.
+#
+# @example
+# make clean
+#/
+clean:
+ $(QUIET) -rm -f *.o *.out
+
+.PHONY: clean
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
new file mode 100644
index 000000000000..44b4ebcc66e0
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
@@ -0,0 +1,46 @@
+/**
+* @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/cfloorf.h"
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/complex/float32/reim.h"
+#include
+
+int main( void ) {
+ const stdlib_complex64_t x[] = {
+ stdlib_complex64( 3.14f, 1.5f ),
+ stdlib_complex64( -3.14f, -1.5f ),
+ stdlib_complex64( 0.0f, 0.0f ),
+ stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
+ };
+
+ stdlib_complex64_t v;
+ stdlib_complex64_t y;
+ float re1;
+ float im1;
+ float re2;
+ float im2;
+ int i;
+ for ( i = 0; i < 4; i++ ) {
+ v = x[ i ];
+ y = stdlib_base_cfloorf( v );
+ stdlib_complex64_reim( v, &re1, &im1 );
+ stdlib_complex64_reim( y, &re2, &im2 );
+ printf( "cfloorf(%f + %fi) = %f + %fi\n", re1, im1, re2, im2 );
+ }
+}
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
new file mode 100644
index 000000000000..cee3d2beb203
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @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';
+
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var randu = require( '@stdlib/random/base/randu' );
+var cfloorf = require( './../lib' );
+
+var re;
+var im;
+var z;
+var w;
+var i;
+
+for ( i = 0; i < 100; i++ ) {
+ re = ( randu()*100.0 ) - 50.0;
+ im = ( randu()*100.0 ) - 50.0;
+ z = new Complex64( re, im );
+ w = cfloorf( z );
+ console.log( 'cfloorf(%s) = %s', z.toString(), w.toString() );
+}
From 0c694213d8579a29bee83c54f2907030a72e4410 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:37:53 +0530
Subject: [PATCH 06/16] feat: docs added
---
.../math/base/special/cfloorf/docs/repl.txt | 27 ++++++++++
.../special/cfloorf/docs/types/index.d.ts | 50 +++++++++++++++++++
.../base/special/cfloorf/docs/types/test.ts | 46 +++++++++++++++++
3 files changed, 123 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/docs/repl.txt
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/test.ts
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/repl.txt
new file mode 100644
index 000000000000..79aa92b8b9a1
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/repl.txt
@@ -0,0 +1,27 @@
+
+{{alias}}( z )
+ Rounds a single-precision complex floating-point number toward negative
+ infinity.
+
+ Parameters
+ ----------
+ z: Complex64
+ Complex number.
+
+ Returns
+ -------
+ out: Complex64
+ Result.
+
+ Examples
+ --------
+ > var v = {{alias}}( new {{alias:@stdlib/complex/float32/ctor}}( 5.5, 3.3 ) )
+
+ > var re = {{alias:@stdlib/complex/float32/real}}( v )
+ 5.0
+ > var im = {{alias:@stdlib/complex/float32/imag}}( v )
+ 3.0
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
new file mode 100644
index 000000000000..fa8181da546a
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
@@ -0,0 +1,50 @@
+/*
+* @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.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { Complex64 } from '@stdlib/types/complex';
+
+/**
+* Rounds a single-precision complex floating-point number toward negative infinity.
+*
+* @param z - input value
+* @returns result
+*
+* @example
+* var Complex64 = require( '@stdlib/complex/float32/ctor' );
+* var real = require( '@stdlib/complex/float32/real' );
+* var imag = require( '@stdlib/complex/float32/imag' );
+*
+* var v = cfloorf( new Complex64( 5.5, 3.3 ) );
+* // returns
+*
+* var re = real( v );
+* // returns 5.0
+*
+* var im = imag( v );
+* // returns 3.0
+*/
+declare function cfloorf( z: Complex64 ): Complex64;
+
+
+// EXPORTS //
+
+export = cfloorf;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/test.ts
new file mode 100644
index 000000000000..a5da380277e7
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/test.ts
@@ -0,0 +1,46 @@
+/*
+* @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.
+*/
+
+import Complex64 = require( '@stdlib/complex/float32/ctor' );
+import cfloorf = require( './index' );
+
+
+// TESTS //
+
+// The function returns an array of numbers...
+{
+ cfloorf( new Complex64( 1.0, 2.0 ) ); // $ExpectType Complex64
+}
+
+// The compiler throws an error if the function is provided a value other than a complex number...
+{
+ cfloorf( 2 ); // $ExpectError
+ cfloorf( true ); // $ExpectError
+ cfloorf( false ); // $ExpectError
+ cfloorf( null ); // $ExpectError
+ cfloorf( undefined ); // $ExpectError
+ cfloorf( '5' ); // $ExpectError
+ cfloorf( [] ); // $ExpectError
+ cfloorf( {} ); // $ExpectError
+ cfloorf( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided insufficient arguments...
+{
+ cfloorf(); // $ExpectError
+}
From f5ef8a0b5b93e0bbf26ddb35b20b096b4ac42b84 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:38:58 +0530
Subject: [PATCH 07/16] chore: changes in docs
---
.../@stdlib/math/base/special/cfloorf/docs/types/index.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
index fa8181da546a..bb673c9a3a9f 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/docs/types/index.d.ts
@@ -1,7 +1,7 @@
/*
* @license Apache-2.0
*
-* Copyright (c) 2019 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.
From 426404056c41feeacacb7104f1ea35bbff4c5986 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 10:48:17 +0530
Subject: [PATCH 08/16] feat: benchmarks added
---
.../special/cfloorf/benchmark/benchmark.js | 84 +++++++++++
.../cfloorf/benchmark/benchmark.native.js | 66 +++++++++
.../base/special/cfloorf/benchmark/c/Makefile | 107 ++++++++++++++
.../special/cfloorf/benchmark/c/benchmark.c | 137 ++++++++++++++++++
4 files changed, 394 insertions(+)
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
create mode 100644 lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.js
new file mode 100644
index 000000000000..afe11a296d98
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.js
@@ -0,0 +1,84 @@
+/**
+* @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/randu' );
+var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var real = require( '@stdlib/complex/float32/real' );
+var imag = require( '@stdlib/complex/float32/imag' );
+var uniform = require( '@stdlib/random/base/uniform' );
+var isArray = require( '@stdlib/assert/is-array' );
+var floorf = require( '@stdlib/math/base/special/floorf' );
+var pkg = require( './../package.json' ).name;
+var cfloorf = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var y;
+ var i;
+
+ values = [
+ new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ),
+ new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ y = cfloorf( ( values[ i%values.length ] ) );
+ if ( isnanf( real( y ) ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnanf( imag( y ) ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::manual', function benchmark( b ) {
+ var re;
+ var im;
+ var y;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ re = ( randu()*1000.0 ) - 500.0;
+ im = ( randu()*1000.0 ) - 500.0;
+ y = [ floorf( re ), floorf( im ) ];
+ if ( y.length === 0 ) {
+ b.fail( 'should not be empty' );
+ }
+ }
+ b.toc();
+ if ( !isArray( y ) ) {
+ b.fail( 'should return an array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
new file mode 100644
index 000000000000..1a2895cbc3c3
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
@@ -0,0 +1,66 @@
+/**
+* @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 uniform = require( '@stdlib/random/base/uniform' );
+var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
+var Complex64 = require( '@stdlib/complex/float32/ctor' );
+var real = require( '@stdlib/complex/float32/real' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+var pkg = require( './../package.json' ).name;
+
+
+// VARIABLES //
+
+var cfloorf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
+var opts = {
+ 'skip': ( cfloorf instanceof Error )
+};
+
+
+// MAIN //
+
+bench( pkg+'::native', opts, function benchmark( b ) {
+ var values;
+ var y;
+ var i;
+
+ values = [
+ new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ),
+ new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ y = cfloorf( values[ i%values.length ] );
+ if ( isnanf( real( y ) ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnanf( real( y ) ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
new file mode 100644
index 000000000000..e4542b1e66e9
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
@@ -0,0 +1,107 @@
+#/
+# @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/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
new file mode 100644
index 000000000000..54d99de4a8bd
--- /dev/null
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -0,0 +1,137 @@
+/**
+* @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
+#include
+#include
+#include
+#include
+
+#define NAME "cfloorf"
+#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 float rand_float( void ) {
+ int r = rand();
+ return (float)r / ( (float)RAND_MAX + 1.0f );
+}
+
+/**
+* Runs a benchmark.
+*
+* @return elapsed time in seconds
+*/
+static double benchmark( void ) {
+ double elapsed;
+ float re;
+ float im;
+ double t;
+ int i;
+
+ float complex z;
+ float complex y;
+
+ t = tic();
+ for ( i = 0; i < ITERATIONS; i++ ) {
+ re = ( 1000.0f * rand_float() ) - 500.0f;
+ im = ( 1000.0f * rand_float() ) - 500.0f;
+ z = re + im*I;
+ y = floorf( crealf(z) ) + floorf( cimagf(z) )*I;
+ if ( y != y ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( y != y ) {
+ printf( "should not return NaN\n" );
+ }
+ return elapsed;
+}
+
+/**
+* Main execution sequence.
+*/
+int main( void ) {
+ double elapsed;
+ int i;
+
+ // Use the current time to seed the random number generator:
+ srand( time( NULL ) );
+
+ print_version();
+ for ( i = 0; i < REPEATS; i++ ) {
+ printf( "# c::%s\n", NAME );
+ elapsed = benchmark();
+ print_results( elapsed );
+ printf( "ok %d benchmark finished\n", i+1 );
+ }
+ print_summary( REPEATS, REPEATS );
+}
From f73da4bec9f609a868bc33e28b495fbe02c9cbef Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 15:47:46 +0530
Subject: [PATCH 09/16] chore: changes from code review
---
.../@stdlib/math/base/special/cfloorf/README.md | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
index 1e303a9e186d..38f78298343e 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
@@ -18,7 +18,7 @@ limitations under the License.
-->
-# Floor
+# cfloorf
> Round a single-precision complex floating-point number toward negative infinity.
@@ -88,21 +88,15 @@ im = imag( v );
```javascript
var Complex64 = require( '@stdlib/complex/float32/ctor' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' ).factory;
var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
-var re;
-var im;
+var rand = uniform( -50.0, 50.0 );
var z;
-var w;
var i;
-
for ( i = 0; i < 100; i++ ) {
- re = ( randu()*100.0 ) - 50.0;
- im = ( randu()*100.0 ) - 50.0;
- z = new Complex64( re, im );
- w = cfloorf( z );
- console.log( 'cfloorf(%s) = %s', z.toString(), w.toString() );
+ z = new Complex64( rand(), rand() );
+ console.log( 'cfloorf(%s) = %s', z, cfloorf( z ) );
}
```
From 566a85d88c481ee148fbb2d5513d215375f872ce Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 19:18:05 +0530
Subject: [PATCH 10/16] chore: changes from code review
---
.../@stdlib/math/base/special/cfloorf/README.md | 2 +-
.../special/cfloorf/benchmark/benchmark.native.js | 2 +-
.../math/base/special/cfloorf/benchmark/c/Makefile | 2 +-
.../base/special/cfloorf/benchmark/c/benchmark.c | 2 +-
.../@stdlib/math/base/special/cfloorf/binding.gyp | 2 +-
.../math/base/special/cfloorf/examples/c/example.c | 2 +-
.../math/base/special/cfloorf/examples/index.js | 14 ++++----------
.../@stdlib/math/base/special/cfloorf/include.gypi | 2 +-
.../@stdlib/math/base/special/cfloorf/lib/index.js | 2 +-
9 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
index 38f78298343e..dd691b78c510 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
@@ -187,7 +187,7 @@ int main( void ) {
stdlib_complex128( 3.14f, 1.5f ),
stdlib_complex128( -3.14f, -1.5f ),
stdlib_complex128( 0.0f, 0.0f ),
- stdlib_complex128( 0.0f/0.0f, 0.0f/0.0f )
+ stdlib_complex128( 0.0f / 0.0f, 0.0f / 0.0f )
};
stdlib_complex64_t v;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
index 1a2895cbc3c3..6f5fca036f8b 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/benchmark.native.js
@@ -52,7 +52,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- y = cfloorf( values[ i%values.length ] );
+ y = cfloorf( values[ i % values.length ] );
if ( isnanf( real( y ) ) ) {
b.fail( 'should not return NaN' );
}
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
index e4542b1e66e9..ad9fedcd4fff 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
@@ -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.
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index 54d99de4a8bd..0e2fe36ff302 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -103,7 +103,7 @@ static double benchmark( void ) {
re = ( 1000.0f * rand_float() ) - 500.0f;
im = ( 1000.0f * rand_float() ) - 500.0f;
z = re + im*I;
- y = floorf( crealf(z) ) + floorf( cimagf(z) )*I;
+ y = floorf( crealf( z ) ) + floorf( cimagf( z ) )*I;
if ( y != y ) {
printf( "should not return NaN\n" );
break;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp b/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
index f2b466aef5c4..ec3992233442 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/binding.gyp
@@ -1,6 +1,6 @@
# @license Apache-2.0
#
-# Copyright (c) 2023 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.
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
index 44b4ebcc66e0..3bc5bd418650 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/example.c
@@ -26,7 +26,7 @@ int main( void ) {
stdlib_complex64( 3.14f, 1.5f ),
stdlib_complex64( -3.14f, -1.5f ),
stdlib_complex64( 0.0f, 0.0f ),
- stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
+ stdlib_complex64( 0.0f / 0.0f, 0.0f / 0.0f )
};
stdlib_complex64_t v;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
index cee3d2beb203..45e29cbf6e8f 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/index.js
@@ -19,19 +19,13 @@
'use strict';
var Complex64 = require( '@stdlib/complex/float32/ctor' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' ).factory;
var cfloorf = require( './../lib' );
-var re;
-var im;
+var rand = uniform( -50.0, 50.0 );
var z;
-var w;
var i;
-
for ( i = 0; i < 100; i++ ) {
- re = ( randu()*100.0 ) - 50.0;
- im = ( randu()*100.0 ) - 50.0;
- z = new Complex64( re, im );
- w = cfloorf( z );
- console.log( 'cfloorf(%s) = %s', z.toString(), w.toString() );
+ z = new Complex64( rand(), rand() );
+ console.log( 'cfloorf(%s) = %s', z, cfloorf( z ) );
}
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi b/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
index 78db9faf8c74..575cb043c0bf 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/include.gypi
@@ -1,6 +1,6 @@
# @license Apache-2.0
#
-# Copyright (c) 2023 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.
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
index af44bd447f27..de660438bba9 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/lib/index.js
@@ -45,7 +45,7 @@
* var cfloorf = require( '@stdlib/math/base/special/cfloorf' );
*
* var v = cfloorf( new Complex64( 9.99999, 0.1 ) );
-* // returns
+* // returns
*
* var re = real( v );
* // returns 9.0
From 3170b82b894397ebac48be5e3531fc477ff9a5d0 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 3 Nov 2024 19:20:59 +0530
Subject: [PATCH 11/16] chore: stuff from code review
---
.../@stdlib/math/base/special/cfloorf/examples/c/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
index f0ae66fecf01..6aed70daf167 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/examples/c/Makefile
@@ -1,7 +1,7 @@
#/
# @license Apache-2.0
#
-# Copyright (c) 2023 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.
From caafd0f57813688fb4e1e229386c1125e1feec32 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 10 Nov 2024 08:52:02 +0530
Subject: [PATCH 12/16] chore: changes from code review
---
.../math/base/special/cfloorf/README.md | 8 ++++----
.../special/cfloorf/benchmark/c/benchmark.c | 18 ++++++++++++------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
index dd691b78c510..bdd477326a43 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/README.md
@@ -184,10 +184,10 @@ stdlib_complex64_t stdlib_base_cfloorf( const stdlib_complex64_t z );
int main( void ) {
const stdlib_complex64_t x[] = {
- stdlib_complex128( 3.14f, 1.5f ),
- stdlib_complex128( -3.14f, -1.5f ),
- stdlib_complex128( 0.0f, 0.0f ),
- stdlib_complex128( 0.0f / 0.0f, 0.0f / 0.0f )
+ stdlib_complex64( 3.14f, 1.5f ),
+ stdlib_complex64( -3.14f, -1.5f ),
+ stdlib_complex64( 0.0f, 0.0f ),
+ stdlib_complex64( 0.0f / 0.0f, 0.0f / 0.0f )
};
stdlib_complex64_t v;
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index 0e2fe36ff302..0865b8268264 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -21,6 +21,9 @@
#include
#include
#include
+#include "stdlib/complex/float32/reim.h"
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/math/base/special/cfloorf.h"
#define NAME "cfloorf"
#define ITERATIONS 1000000
@@ -95,22 +98,25 @@ static double benchmark( void ) {
double t;
int i;
- float complex z;
- float complex y;
+ stdlib_complex64_t z;
+ stdlib_complex64_t y;
+ float a;
+ float b;
t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
re = ( 1000.0f * rand_float() ) - 500.0f;
im = ( 1000.0f * rand_float() ) - 500.0f;
- z = re + im*I;
- y = floorf( crealf( z ) ) + floorf( cimagf( z ) )*I;
- if ( y != y ) {
+ z = stdlib_complex64( re, im );
+ y = stdlib_base_cfloorf( z );
+ stdlib_complex64_reim( y, &a, &b );
+ if ( a != a || b != b ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
- if ( y != y ) {
+ if ( a != a || b != b ) {
printf( "should not return NaN\n" );
}
return elapsed;
From 08c5953a012f3403110a17b8b0af48497eb5442f Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 10 Nov 2024 09:00:27 +0530
Subject: [PATCH 13/16] fix: benchmark compilation errors
---
.../@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index 0865b8268264..18857485e5ff 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -21,8 +21,6 @@
#include
#include
#include
-#include "stdlib/complex/float32/reim.h"
-#include "stdlib/complex/float32/ctor.h"
#include "stdlib/math/base/special/cfloorf.h"
#define NAME "cfloorf"
From 1793c88fb0a7c53664d6f8ee2fa69a16f5cb7726 Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 10 Nov 2024 09:03:41 +0530
Subject: [PATCH 14/16] fix: compilation isssues in benchmarks
---
.../@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index 18857485e5ff..0865b8268264 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -21,6 +21,8 @@
#include
#include
#include
+#include "stdlib/complex/float32/reim.h"
+#include "stdlib/complex/float32/ctor.h"
#include "stdlib/math/base/special/cfloorf.h"
#define NAME "cfloorf"
From 75d9d38fad7a7709a739cad2cc54c385a96a321c Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 10 Nov 2024 09:13:06 +0530
Subject: [PATCH 15/16] fix: compilation error in benchmark
---
.../math/base/special/cfloorf/benchmark/c/benchmark.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index 0865b8268264..f274ade9ef0a 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -16,14 +16,14 @@
* limitations under the License.
*/
+#include "stdlib/complex/float32/reim.h"
+#include "stdlib/complex/float32/ctor.h"
+#include "stdlib/math/base/special/cfloorf.h"
#include
#include
#include
#include
#include
-#include "stdlib/complex/float32/reim.h"
-#include "stdlib/complex/float32/ctor.h"
-#include "stdlib/math/base/special/cfloorf.h"
#define NAME "cfloorf"
#define ITERATIONS 1000000
From 757ba1aa269064aac9e1ce315f920832496cbb3d Mon Sep 17 00:00:00 2001
From: aayush0325 <96649223+aayush0325@users.noreply.github.com>
Date: Sun, 10 Nov 2024 09:14:46 +0530
Subject: [PATCH 16/16] fix: compilation errors
---
.../base/special/cfloorf/benchmark/c/Makefile | 79 ++++++++++++++-----
.../special/cfloorf/benchmark/c/benchmark.c | 2 +-
2 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
index ad9fedcd4fff..f69e9da2b4d3 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/Makefile
@@ -16,14 +16,15 @@
# limitations under the License.
#/
-
# VARIABLES #
ifndef VERBOSE
QUIET := @
+else
+ QUIET :=
endif
-# Determine the OS:
+# Determine the OS ([1][1], [2][2]).
#
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
# [2]: http://stackoverflow.com/a/27776822/2225624
@@ -36,6 +37,10 @@ ifneq (, $(findstring MSYS,$(OS)))
else
ifneq (, $(findstring CYGWIN,$(OS)))
OS := WINNT
+else
+ifneq (, $(findstring Windows_NT,$(OS)))
+ OS := WINNT
+endif
endif
endif
endif
@@ -54,7 +59,7 @@ CFLAGS ?= \
-Wall \
-pedantic
-# Determine whether to generate [position independent code][1]:
+# 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
@@ -64,43 +69,77 @@ 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
-# TARGETS #
+# RULES #
-# Default target.
+#/
+# Compiles source files.
#
-# This target is the 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
+#/
all: $(c_targets)
.PHONY: all
-
-# Compile C source.
+#/
+# Compiles C source files.
#
-# This target 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) -o $@ $< -lm
-
+ $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
-# Run a benchmark.
+#/
+# Runs compiled benchmarks.
#
-# This target runs a benchmark.
-
+# @example
+# make run
+#/
run: $(c_targets)
$(QUIET) ./$<
.PHONY: run
-
-# Perform clean-up.
+#/
+# Removes generated files.
#
-# This target removes generated files.
-
+# @example
+# make clean
+#/
clean:
$(QUIET) -rm -f *.o *.out
diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
index f274ade9ef0a..32d41b41cdc7 100644
--- a/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/cfloorf/benchmark/c/benchmark.c
@@ -16,9 +16,9 @@
* limitations under the License.
*/
+#include "stdlib/math/base/special/cfloorf.h"
#include "stdlib/complex/float32/reim.h"
#include "stdlib/complex/float32/ctor.h"
-#include "stdlib/math/base/special/cfloorf.h"
#include
#include
#include