diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/LICENSE b/lib/node_modules/@stdlib/math/base/special/acoshf/LICENSE new file mode 100644 index 000000000000..a7566ad6f2c3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/LICENSE @@ -0,0 +1,192 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +DEPENDENCIES & ATTRIBUTION + +The library links against the following external libraries or contains +implementations from the following external libraries, which have their own +licenses: + +* FreeBSD + +Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/README.md b/lib/node_modules/@stdlib/math/base/special/acoshf/README.md new file mode 100644 index 000000000000..b4b7bb7d496b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/README.md @@ -0,0 +1,203 @@ + + +# acoshf + +> Compute the [hyperbolic arccosine][hyperbolic-arccosine] of a single-precision floating-point number. + +
+ +## Usage + +```javascript +var acoshf = require( '@stdlib/math/base/special/acoshf' ); +``` + +#### acoshf( x ) + +Computes the [hyperbolic arccosine][hyperbolic-arccosine] of single-precision floating-point number. + +```javascript +var v = acoshf( 1.0 ); +// returns 0.0 + +v = acoshf( 2.0 ); +// returns ~1.317 + +v = acoshf( 0.5 ); +// returns NaN +``` + +The domain of `x` is restricted to `[1,+infinity)`. If `x < 1`, the function will return `NaN`. + +```javascript +var v = acoshf( 0.0 ); +// returns NaN +``` + +
+ + + +
+ +## Examples + + + +```javascript +var linspace = require( '@stdlib/array/base/linspace' ); +var acoshf = require( '@stdlib/math/base/special/acoshf' ); + +var x = linspace( 1.0, 5.0, 100 ); + +var i; +for ( i = 0; i < x.length; i++ ) { + console.log( acoshf( x[ i ] ) ); +} +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/acoshf.h" +``` + +#### stdlib_base_acoshf( x ) + +Computes the [hyperbolic arccosine][hyperbolic-arccosine] of single-precision floating-point number. + +```c +float out = stdlib_base_acoshf( 1.0f ); +// returns 0.0 + +out = stdlib_base_acoshf( 2.0f ); +// returns ~1.317 +``` + +The function accepts the following arguments: + +- **x**: `[in] float` input value. + +```c +float stdlib_base_acoshf( const float x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/acoshf.h" +#include + +int main( void ) { + const float x[] = { 1.0f, 1.45f, 1.89f, 2.33f, 2.78f, 3.22f, 3.66f, 4.11f, 4.55f, 5.0f }; + + float v; + int i; + for ( i = 0; i < 10; i++ ) { + v = stdlib_base_acoshf( x[ i ] ); + printf( "acoshf(%f) = %f\n", x[ i ], v ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.js new file mode 100644 index 000000000000..dbc78bdb7699 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.js @@ -0,0 +1,81 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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 uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pkg = require( './../package.json' ).name; +var acoshf = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': ( typeof Math.acoshf !== 'function' ) // eslint-disable-line stdlib/no-builtin-math +}; + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, 1.0, 100.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = acoshf( x[ i % x.length ] ); + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::built-in', opts, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, 1.0, 100.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = Math.acoshf( x[ i % x.length ] ); // eslint-disable-line stdlib/no-builtin-math + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.native.js new file mode 100644 index 000000000000..947027cd9f1b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/benchmark.native.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2022 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var acoshf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( acoshf instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, 1.0, 100.0 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = acoshf( x[ i % x.length ] ); + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/Makefile new file mode 100644 index 000000000000..d564e8b2d6f9 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/Makefile @@ -0,0 +1,127 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles C source files. +# +# @param {string} [C_COMPILER] - C compiler +# @param {string} [CFLAGS] - C compiler flags +# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler +# @param {string} CFLAGS - C compiler flags +# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/benchmark.c new file mode 100644 index 000000000000..cf6c093ef5f0 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/benchmark/c/benchmark.c @@ -0,0 +1,135 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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 "acoshf" +#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 x[ 100 ]; + double t; + float y; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0f*rand_float() ) + 1.0f; + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = acoshf( x[ i % 100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int i; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# c::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/binding.gyp b/lib/node_modules/@stdlib/math/base/special/acoshf/binding.gyp new file mode 100644 index 000000000000..1058b57bab16 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2022 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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/acoshf/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/repl.txt new file mode 100644 index 000000000000..f1afffba9abe --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( x ) + Computes the hyperbolic arccosine of a single-precision floating-point + number. + + If `x < 1`, the function returns `NaN`. + + Parameters + ---------- + x: number + Input value. + + Returns + ------- + y: number + Hyperbolic arccosine. + + Examples + -------- + > var y = {{alias}}( 1.0 ) + 0.0 + > y = {{alias}}( 2.0 ) + ~1.317 + > y = {{alias}}( NaN ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/index.d.ts new file mode 100644 index 000000000000..d3d8bf918174 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/index.d.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Computes the hyperbolic arccosine of a single-precision floating-point number. +* +* @param x - input value +* @returns hyperbolic arccosine +* +* @example +* var v = acoshf( 1.0 ); +* // returns 0.0 +* +* @example +* var v = acoshf( 2.0 ); +* // returns ~1.317 +* +* @example +* var v = acoshf( NaN ); +* // returns NaN +*/ +declare function acoshf( x: number ): number; + + +// EXPORTS // + +export = acoshf; diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/test.ts new file mode 100644 index 000000000000..cc50cc954cf7 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/docs/types/test.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import acoshf = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + acoshf( 8 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + acoshf( true ); // $ExpectError + acoshf( false ); // $ExpectError + acoshf( null ); // $ExpectError + acoshf( undefined ); // $ExpectError + acoshf( '5' ); // $ExpectError + acoshf( [] ); // $ExpectError + acoshf( {} ); // $ExpectError + acoshf( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + acoshf(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/c/Makefile new file mode 100644 index 000000000000..25ced822f96a --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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/acoshf/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/c/example.c new file mode 100644 index 000000000000..14733779c4da --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/c/example.c @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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/acoshf.h" +#include + +int main( void ) { + const float x[] = { 1.0f, 1.45f, 1.89f, 2.33f, 2.78f, 3.22f, 3.66f, 4.11f, 4.55f, 5.0f }; + + float v; + int i; + for ( i = 0; i < 10; i++ ) { + v = stdlib_base_acoshf( x[ i ] ); + printf( "acoshf(%f) = %f\n", x[ i ], v ); + } +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/examples/index.js b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/index.js new file mode 100644 index 000000000000..1c55bb9e929d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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 linspace = require( '@stdlib/array/base/linspace' ); +var acoshf = require( './../lib' ); + +var x = linspace( 1.0, 5.0, 100 ); + +var i; +for ( i = 0; i < x.length; i++ ) { + console.log( 'acoshf( %d ) = %d', x[ i ], acoshf( x[ i ] ) ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/include.gypi b/lib/node_modules/@stdlib/math/base/special/acoshf/include.gypi new file mode 100644 index 000000000000..3b437d524797 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2022 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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': [ + ' 2 \\ +* \operatorname{log1pf}\left( x - 1 + \sqrtf{ 2 \cdot (x-1) + (x-1)^2 } \right) & \text{ otherwise } +* \end{cases} +* ``` +* +* ## Special Cases +* +* ```tex +* \begin{align*} +* \operatorname{acoshf}(x) &= \mathrm{NaN}\ \text{ if } x < 1 \\ +* \end{align*} +* ``` +* +* @param {number} x - input value +* @returns {number} hyperbolic arccosine +* +* @example +* var v = acoshf( 1.0 ); +* // returns 0.0 +* +* @example +* var v = acoshf( 2.0 ); +* // returns ~1.317 +* +* @example +* var v = acoshf( NaN ); +* // returns NaN +*/ +function acoshf( x ) { + var t; + if ( isnanf( x ) || x < 1.0 ) { + return NaN; + } + if ( x === 1.0 ) { + return 0.0; + } + if ( x >= HUGE ) { + return lnf( x ) + FLOAT32_LN2; + } + if ( x > 2.0 ) { + return lnf( (2.0*x) - ( 1.0 / ( x + sqrtf( (x*x) - 1.0 ) ) ) ); + } + // Case: 2 >= x > 1 + t = x - 1.0; + return log1pf( t + sqrtf( (2.0*t) + (t*t) ) ); +} + + +// EXPORTS // + +module.exports = acoshf; diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/lib/native.js b/lib/node_modules/@stdlib/math/base/special/acoshf/lib/native.js new file mode 100644 index 000000000000..53bc23df6217 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/lib/native.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Compute the hyperbolic arccosine of a single-precision floating-point number. +* +* @private +* @param {number} x - input value +* @returns {number} hyperbolic arccosine +* +* @example +* var v = acoshf( 1.0 ); +* // returns 0.0 +* +* @example +* var v = acoshf( 2.0 ); +* // returns ~1.317 +* +* @example +* var v = acoshf( NaN ); +* // returns NaN +*/ +function acoshf( x ) { + return addon( x ); +} + + +// EXPORTS // + +module.exports = acoshf; diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/manifest.json b/lib/node_modules/@stdlib/math/base/special/acoshf/manifest.json new file mode 100644 index 000000000000..f5deb85936f0 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/manifest.json @@ -0,0 +1,84 @@ +{ + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/napi/unary", + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/special/log1pf", + "@stdlib/math/base/special/sqrtf", + "@stdlib/math/base/special/lnf", + "@stdlib/constants/float32/ln-two" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/special/log1pf", + "@stdlib/math/base/special/sqrtf", + "@stdlib/math/base/special/lnf", + "@stdlib/constants/float32/ln-two" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/special/log1pf", + "@stdlib/math/base/special/sqrtf", + "@stdlib/math/base/special/lnf", + "@stdlib/constants/float32/ln-two" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/package.json b/lib/node_modules/@stdlib/math/base/special/acoshf/package.json new file mode 100644 index 000000000000..c8ca692da9dd --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/package.json @@ -0,0 +1,77 @@ +{ + "name": "@stdlib/math/base/special/acoshf", + "version": "0.0.0", + "description": "Compute the hyperbolic arccosine of a single-precision floating-point number.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "scripts": "./scripts", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "math.acosh", + "math.acoshf", + "acosh", + "acoshf", + "hyperbolic", + "inverse", + "cosine", + "cos", + "arc", + "arccosine", + "trig", + "trigonometry", + "radians", + "angle", + "polyfill", + "ponyfill" + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/src/Makefile b/lib/node_modules/@stdlib/math/base/special/acoshf/src/Makefile new file mode 100644 index 000000000000..6268192a343f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/src/Makefile @@ -0,0 +1,71 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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/acoshf/src/addon.c b/lib/node_modules/@stdlib/math/base/special/acoshf/src/addon.c new file mode 100644 index 000000000000..507e04d3d0a3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/src/addon.c @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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/acoshf.h" +#include "stdlib/math/base/napi/unary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_F_F( stdlib_base_acoshf ) diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/src/main.c b/lib/node_modules/@stdlib/math/base/special/acoshf/src/main.c new file mode 100644 index 000000000000..5127dc1c00dd --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/src/main.c @@ -0,0 +1,96 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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. +* +* +* ## Notice +* +* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/e_acoshf.c?view=markup}. The implementation follows the original, but has been modified according to project conventions. +* +* ```text +* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. +* +* Developed at SunPro, a Sun Microsystems, Inc. business. +* Permission to use, copy, modify, and distribute this +* software is freely granted, provided that this notice +* is preserved. +* ``` +*/ + +#include "stdlib/math/base/special/acoshf.h" +#include "stdlib/math/base/assert/is_nanf.h" +#include "stdlib/math/base/special/log1pf.h" +#include "stdlib/math/base/special/sqrtf.h" +#include "stdlib/math/base/special/lnf.h" +#include "stdlib/constants/float32/ln_two.h" +#include + +static const float HUGE = 1 << 28; // 2**28 + +/** +* Computes the hyperbolic arccosine of single-precision floating-point number. +* +* ## Method +* +* Based on +* +* ```tex +* \operatorname{acoshf}(x) = \logf \left[ x + \sqrtf{ x^2 - 1 } \right] +* ``` +* +* we have +* +* ```tex +* \operatorname{acoshf}(x) = \begin{cases} +* \logf(x) + \tfrac{\lnf}{2} & \text{ if x is large } \\ +* \logf \left( 2x-\tfrac{1}{\sqrtf{x^2-1}+x} \right) & \text{ if } x > 2 \\ +* \operatorname{log1pf}\left( x - 1 + \sqrtf{ 2 \cdotf (x-1) + (x-1)^2 } \right) & \text{ otherwise } +* \end{cases} +* ``` +* +* ## Special Cases +* +* ```tex +* \begin{align*} +* \operatorname{acoshf}(x) &= \mathrm{NaN}\ \text{ if } x < 1 \\ +* \end{align*} +* ``` +* +* @param x input value +* @return output value +* +* @example +* float out = stdlib_base_acoshf( 1.0f ); +* // returns 0.0f +*/ +float stdlib_base_acoshf( const float x ) { + float t; + if ( stdlib_base_is_nanf( x ) || x < 1.0 ) { + return 0.0 / 0.0; // NaN + } + if ( x == 1.0 ) { + return 0.0; + } + if ( x >= HUGE ) { + return stdlib_base_lnf( x ) + STDLIB_CONSTANT_FLOAT32_LN2; + } + if ( x > 2.0 ) { + return stdlib_base_lnf( ( 2.0 * x ) - ( 1.0 / ( x + stdlib_base_sqrtf( ( x * x ) - 1.0 ) ) ) ); + } + // Case: 2 >= x > 1 + t = x - 1.0; + return stdlib_base_log1pf( t + stdlib_base_sqrtf( ( 2.0 * t ) + ( t * t ) ) ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..308c3be89c85 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/REQUIRE @@ -0,0 +1,2 @@ +julia 1.5 +JSON 0.21 diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/large_positive.json b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/large_positive.json new file mode 100644 index 000000000000..10310424bba7 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/large_positive.json @@ -0,0 +1 @@ +{"expected":[1.7627472,1.780296,1.7975248,1.8144456,1.8310698,1.847408,1.8634706,1.8792667,1.8948057,1.910096,1.925146,1.9399632,1.9545552,1.9689287,1.9830906,1.9970473,2.0108047,2.0243688,2.0377448,2.0509384,2.0639544,2.0767977,2.089473,2.101985,2.1143377,2.1265352,2.1385813,2.1504803,2.1622355,2.1738505,2.1853287,2.1966734,2.2078876,2.2189744,2.2299368,2.2407777,2.2514994,2.2621052,2.272597,2.2829776,2.2932494,2.3034146,2.3134756,2.3234344,2.333293,2.3430536,2.352718,2.3622885,2.3717663,2.3811538,2.3904524,2.399664,2.4087899,2.4178321,2.4267921,2.435671,2.444471,2.4531927,2.461838,2.4704082,2.4789045,2.487328,2.4956806,2.5039628,2.5121758,2.5203214,2.5284004,2.5364134,2.5443623,2.5522475,2.5600705,2.5678318,2.5755327,2.5831742,2.590757,2.598282,2.6057503,2.6131628,2.6205199,2.6278229,2.6350722,2.642269,2.6494136,2.656507,2.6635501,2.6705434,2.6774879,2.6843839,2.6912322,2.6980333,2.7047884,2.7114975,2.7181616,2.7247813,2.7313569,2.7378893,2.744379,2.7508264,2.7572322,2.7635968,2.769921,2.776205,2.7824497,2.788655,2.794822,2.8009508,2.8070421,2.813096,2.8191135,2.8250947,2.83104,2.8369498,2.842825,2.8486652,2.8544717,2.8602443,2.8659835,2.8716898,2.8773632,2.883005,2.8886144,2.8941925,2.8997395,2.9052558,2.9107416,2.916197,2.921623,2.9270194,2.9323866,2.9377253,2.9430351,2.948317,2.9535708,2.958797,2.963996,2.969168,2.974313,2.9794319,2.9845243,2.989591,2.9946318,2.9996471,3.0046375,3.009603,3.0145438,3.01946,3.0243523,3.0292206,3.034065,3.038886,3.043684,3.0484588,3.053211,3.0579405,3.0626476,3.0673325,3.0719955,3.0766368,3.0812566,3.085855,3.0904324,3.0949888,3.0995243,3.1040392,3.108534,3.1130085,3.1174629,3.1218977,3.1263125,3.1307082,3.1350844,3.1394413,3.1437793,3.1480985,3.1523993,3.1566813,3.1609452,3.165191,3.1694183,3.1736283,3.1778202,3.181995,3.186152,3.1902916,3.1944144,3.1985202,3.202609,3.206681,3.2107368,3.2147758,3.2187989,3.2228055,3.2267962,3.2307708,3.2347298,3.238673,3.2426007,3.2465131,3.25041,3.254292,3.258159,3.2620108,3.265848,3.2696702,3.273478,3.2772713,3.2810502,3.2848148,3.2885652,3.2923014,3.296024,3.2997327,3.3034275,3.3071089,3.3107765,3.3144307,3.3180716,3.3216994,3.3253138,3.3289154,3.332504,3.3360796,3.3396425,3.3431928,3.3467302,3.3502555,3.353768,3.3572686,3.3607566,3.3642328,3.3676965,3.3711486,3.3745885,3.3780167,3.3814332,3.3848379,3.3882313,3.391613,3.3949833,3.3983421,3.4016898,3.4050264,3.4083517,3.4116662,3.4149694,3.418262,3.4215436,3.4248145,3.4280746,3.4313242,3.4345632,3.4377918,3.44101,3.4442177,3.447415,3.4506025,3.4537797,3.4569466,3.4601038,3.4632509,3.466388,3.4695153,3.472633,3.475741,3.4788392,3.4819279,3.4850068,3.4880764,3.4911368,3.4941878,3.4972293,3.5002618,3.503285,3.506299,3.5093038,3.5122998,3.515287,3.518265,3.521234,3.5241945,3.527146,3.5300891,3.5330234,3.535949,3.5388663,3.541775,3.544675,3.5475671,3.5504503,3.5533257,3.5561924,3.5590513,3.5619018,3.5647442,3.5675786,3.5704048,3.573223,3.5760336,3.578836,3.5816307,3.5844176,3.5871968,3.5899682,3.592732,3.595488,3.5982366,3.6009774,3.603711,3.606437,3.6091557,3.6118667,3.6145706,3.6172671,3.6199565,3.6226385,3.6253133,3.6279812,3.6306417,3.6332953,3.635942,3.6385815,3.641214,3.6438396,3.6464584,3.6490703,3.6516755,3.6542737,3.6568654,3.6594503,3.6620283,3.6646,3.667165,3.6697235,3.6722753,3.6748207,3.6773593,3.6798918,3.6824179,3.6849377,3.687451,3.6899579,3.6924586,3.6949532,3.6974413,3.6999235,3.7023995,3.7048693,3.707333,3.7097907,3.7122424,3.7146878,3.7171276,3.7195613,3.7219892,3.724411,3.7268271,3.7292373,3.7316418,3.7340403,3.7364333,3.7388206,3.7412019,3.7435777,3.7459478,3.7483125,3.7506714,3.753025,3.7553728,3.7577152,3.7600522,3.7623837,3.7647097,3.7670302,3.7693455,3.7716553,3.7739599,3.7762592,3.7785532,3.7808418,3.7831254,3.7854037,3.7876768,3.7899446,3.7922077,3.7944653,3.796718,3.7989655,3.8012078,3.8034453,3.805678,3.8079052,3.8101277,3.8123455,3.814558,3.816766,3.8189688,3.821167,3.8233602,3.8255486,3.8277323,3.8299112,3.8320854,3.8342547,3.8364196,3.8385797,3.840735,3.8428857,3.845032,3.8471735,3.8493104,3.8514428,3.8535707,3.855694,3.857813,3.8599272,3.8620372,3.8641424,3.8662436,3.86834,3.8704324,3.8725202,3.8746037,3.8766828,3.8787577,3.8808281,3.8828945,3.8849564,3.8870142,3.8890676,3.891117,3.893162,3.8952029,3.8972397,3.8992724,3.901301,3.9033253,3.9053457,3.9073617,3.909374,3.9113822,3.913386,3.9153862,3.9173822,3.9193745,3.9213626,3.9233468,3.925327,3.9273033,3.9292758,3.9312444,3.933209,3.9351697,3.9371269,3.93908,3.9410293,3.9429748,3.9449167,3.9468546,3.948789,3.9507194,3.9526463,3.9545693,3.9564886,3.9584043,3.9603164,3.962225,3.9641297,3.9660308,3.9679282,3.9698222,3.9717126,3.9735994,3.9754825,3.9773622,3.9792385,3.981111,3.9829803,3.9848456,3.986708,3.9885666,3.9904218,3.9922736,3.994122,3.9959671,3.9978087,3.999647,4.0014815,4.003313,4.0051413,4.006966,4.0087876,4.0106053,4.01242,4.0142317,4.0160403,4.017845,4.0196466,4.0214453,4.0232406,4.0250325],"x":[3.0,3.0501,3.1002004,3.1503005,3.2004008,3.250501,3.3006012,3.3507013,3.4008017,3.4509017,3.501002,3.5511022,3.6012025,3.6513026,3.701403,3.751503,3.8016033,3.8517034,3.9018035,3.9519038,4.002004,4.052104,4.1022043,4.1523046,4.202405,4.252505,4.302605,4.3527055,4.402806,4.4529057,4.503006,4.5531063,4.6032066,4.6533065,4.703407,4.753507,4.803607,4.8537073,4.9038076,4.953908,5.004008,5.054108,5.1042085,5.154309,5.2044086,5.254509,5.3046093,5.3547096,5.4048095,5.45491,5.50501,5.5551105,5.6052103,5.6553106,5.705411,5.755511,5.805611,5.8557115,5.905812,5.9559116,6.006012,6.0561123,6.1062126,6.1563125,6.206413,6.256513,6.3066134,6.3567133,6.4068136,6.456914,6.507014,6.557114,6.6072145,6.657315,6.7074146,6.757515,6.8076153,6.8577156,6.9078155,6.957916,7.008016,7.0581164,7.1082163,7.1583166,7.208417,7.2585173,7.308617,7.3587174,7.408818,7.4589176,7.509018,7.5591183,7.6092186,7.6593184,7.709419,7.759519,7.8096194,7.8597193,7.9098196,7.95992,8.01002,8.060121,8.110221,8.16032,8.210421,8.260521,8.310621,8.360722,8.410822,8.460922,8.511022,8.561122,8.611222,8.661323,8.711423,8.761523,8.811624,8.861724,8.911823,8.961924,9.012024,9.062124,9.112225,9.162325,9.212425,9.262525,9.312625,9.362725,9.412826,9.462926,9.513026,9.563127,9.613227,9.663326,9.713427,9.763527,9.813627,9.863728,9.913828,9.963928,10.014028,10.064128,10.114228,10.164329,10.214429,10.264529,10.31463,10.36473,10.414829,10.46493,10.51503,10.56513,10.615231,10.665331,10.715431,10.765531,10.815631,10.865731,10.915832,10.965932,11.016032,11.066133,11.116233,11.166332,11.216433,11.266533,11.316633,11.366734,11.416834,11.466934,11.517035,11.567134,11.617234,11.667335,11.717435,11.767535,11.817636,11.867736,11.917835,11.967936,12.018036,12.068136,12.118237,12.168337,12.218437,12.2685375,12.318637,12.368737,12.418838,12.468938,12.519038,12.569139,12.619239,12.669338,12.719439,12.769539,12.819639,12.86974,12.91984,12.96994,13.0200405,13.07014,13.12024,13.170341,13.220441,13.270541,13.3206415,13.370742,13.420841,13.470942,13.521042,13.571142,13.621243,13.671343,13.721443,13.7715435,13.821643,13.871743,13.921844,13.971944,14.022044,14.0721445,14.122245,14.172345,14.222445,14.272545,14.322645,14.3727455,14.422846,14.472946,14.5230465,14.573146,14.623246,14.6733465,14.723447,14.773547,14.8236475,14.873748,14.923848,14.973948,15.024048,15.074148,15.1242485,15.174349,15.224449,15.2745495,15.324649,15.374749,15.4248495,15.47495,15.52505,15.5751505,15.625251,15.675351,15.7254505,15.775551,15.825651,15.8757515,15.925852,15.975952,16.026052,16.076153,16.126253,16.176353,16.226454,16.276552,16.326653,16.376753,16.426853,16.476954,16.527054,16.577154,16.627254,16.677355,16.727455,16.777555,16.827656,16.877756,16.927856,16.977957,17.028055,17.078156,17.128256,17.178356,17.228456,17.278557,17.328657,17.378757,17.428858,17.478958,17.529058,17.579159,17.62926,17.67936,17.72946,17.779558,17.829659,17.879759,17.92986,17.97996,18.03006,18.08016,18.13026,18.18036,18.230461,18.280561,18.330662,18.380762,18.430862,18.480963,18.531061,18.581161,18.631262,18.681362,18.731462,18.781563,18.831663,18.881763,18.931864,18.981964,19.032064,19.082165,19.132265,19.182365,19.232466,19.282566,19.332664,19.382765,19.432865,19.482965,19.533066,19.583166,19.633266,19.683367,19.733467,19.783567,19.833668,19.883768,19.933868,19.983969,20.03407,20.084167,20.134268,20.184368,20.234468,20.284569,20.33467,20.38477,20.43487,20.48497,20.53507,20.58517,20.635271,20.685371,20.735472,20.785572,20.83567,20.88577,20.935871,20.985971,21.036072,21.086172,21.136272,21.186373,21.236473,21.286573,21.336674,21.386774,21.436874,21.486975,21.537075,21.587173,21.637274,21.687374,21.737474,21.787575,21.837675,21.887775,21.937876,21.987976,22.038076,22.088177,22.138277,22.188377,22.238478,22.288578,22.338676,22.388777,22.438877,22.488977,22.539078,22.589178,22.639278,22.689379,22.73948,22.78958,22.83968,22.88978,22.93988,22.98998,23.040081,23.09018,23.14028,23.19038,23.24048,23.29058,23.340681,23.390781,23.440882,23.490982,23.541082,23.591183,23.641283,23.691383,23.741484,23.791584,23.841682,23.891783,23.941883,23.991983,24.042084,24.092184,24.142284,24.192385,24.242485,24.292585,24.342686,24.392786,24.442886,24.492987,24.543087,24.593185,24.643286,24.693386,24.743486,24.793587,24.843687,24.893787,24.943888,24.993988,25.044088,25.094189,25.144289,25.19439,25.24449,25.29459,25.34469,25.394789,25.44489,25.49499,25.54509,25.59519,25.64529,25.69539,25.745491,25.795591,25.845692,25.895792,25.945892,25.995993,26.046093,26.096193,26.146292,26.196392,26.246492,26.296593,26.346693,26.396793,26.446894,26.496994,26.547094,26.597195,26.647295,26.697395,26.747496,26.797596,26.847696,26.897795,26.947895,26.997995,27.048096,27.098196,27.148296,27.198397,27.248497,27.298597,27.348698,27.398798,27.448898,27.498999,27.549099,27.5992,27.649298,27.699398,27.749498,27.799599,27.849699,27.8998,27.9499,28.0]} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/larger_positive.json b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/larger_positive.json new file mode 100644 index 000000000000..bbf0b192595c --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/larger_positive.json @@ -0,0 +1 @@ +{"expected":[4.0250325,4.0301757,4.0352926,4.0403833,4.0454483,4.050488,4.055502,4.060491,4.0654554,4.0703955,4.075311,4.0802026,4.08507,4.0899143,4.0947347,4.0995326,4.104307,4.109059,4.113788,4.1184955,4.1231804,4.127844,4.1324854,4.1371055,4.1417046,4.146282,4.1508393,4.1553755,4.159891,4.1643867,4.168862,4.1733174,4.177753,4.182169,4.1865654,4.190943,4.195301,4.1996403,4.203961,4.208263,4.2125463,4.2168117,4.221059,4.225288,4.2294993,4.233693,4.2378693,4.2420278,4.2461696,4.2502937,4.2544017,4.258492,4.262566,4.2666235,4.2706647,4.2746897,4.2786984,4.282691,4.286668,4.290629,4.2945743,4.298504,4.302418,4.306318,4.3102016,4.3140707,4.317925,4.3217645,4.3255887,4.329399,4.3331947,4.3369756,4.3407426,4.3444953,4.348234,4.351959,4.35567,4.3593674,4.3630514,4.366721,4.370378,4.3740215,4.3776517,4.381269,4.384873,4.388464,4.392042,4.3956075,4.3991604,4.4027004,4.406228,4.4097433,4.4132466,4.416737,4.4202156,4.423682,4.427137,4.4305797,4.4340105,4.4374294,4.440837,4.444233,4.4476175,4.45099,4.454352,4.457702,4.4610415,4.4643693,4.4676867,4.4709926,4.4742875,4.477572,4.4808455,4.4841084,4.487361,4.4906025,4.493834,4.4970546,4.500265,4.503465,4.506655,4.5098352,4.513005,4.516165,4.519315,4.5224543,4.5255847,4.5287046,4.5318155,4.5349164,4.5380077,4.5410895,4.5441623,4.547225,4.5502787,4.553323,4.556358,4.559384,4.5624003,4.565408,4.568407,4.5713964,4.5743775,4.577349,4.5803123,4.5832667,4.586212,4.5891495,4.5920777,4.5949974,4.597909,4.600812,4.6037064,4.606592,4.6094704,4.61234,4.615201,4.6180544,4.620899,4.6237364,4.6265655,4.6293864,4.6321993,4.6350045,4.6378016,4.640591,4.643373,4.646147,4.6489134,4.651672,4.654423,4.6571665,4.6599026,4.6626315,4.6653523,4.668066,4.6707726,4.673472,4.6761637,4.6788483,4.6815257,4.684196,4.686859,4.689515,4.6921644,4.6948066,4.6974416,4.70007,4.702691,4.7053056,4.707913,4.7105136,4.713108,4.7156954,4.718276,4.72085,4.7234173,4.7259784,4.728533,4.7310805,4.7336216,4.7361565,4.738685,4.741207,4.743723,4.7462325,4.7487354,4.7512326,4.753723,4.7562075,4.758686,4.7611585,4.763624,4.766084,4.7685385,4.7709866,4.7734284,4.7758646,4.7782946,4.780719,4.7831373,4.78555,4.7879567,4.7903576,4.7927527,4.795142,4.7975264,4.7999043,4.8022766,4.8046436,4.807005,4.8093605,4.811711,4.8140554,4.816395,4.8187284,4.821057,4.8233795,4.825697,4.828009,4.830316,4.8326173,4.8349137,4.8372045,4.8394904,4.8417706,4.844046,4.8463163,4.8485813,4.850841,4.853096,4.8553457,4.85759,4.85983,4.862065,4.864294,4.866519,4.8687387,4.8709536,4.8731637,4.8753686,4.8775687,4.879764,4.8819547,4.8841405,4.8863215,4.888498,4.8906693,4.892836,4.8949986,4.897156,4.8993087,4.901457,4.9036,4.9057393,4.907874,4.9100037,4.912129,4.91425,4.9163666,4.9184785,4.9205856,4.922689,4.9247875,4.926882,4.9289713,4.931057,4.933138,4.935215,4.9372873,4.939356,4.9414196,4.9434795,4.9455347,4.947586,4.949633,4.951676,4.953715,4.955749,4.95778,4.959806,4.961828,4.963846,4.9658604,4.96787,4.9698763,4.9718785,4.9738765,4.97587,4.9778605,4.9798465,4.9818287,4.9838066,4.985781,4.9877515,4.989718,4.9916806,4.9936395,4.9955945,4.9975457,4.999493,5.0014367,5.0033765,5.0053124,5.007245,5.0091734,5.0110984,5.0130196,5.014937,5.016851,5.018761,5.0206676,5.0225706,5.02447,5.0263658,5.028258,5.0301466,5.032031,5.0339127,5.0357904,5.037665,5.039536,5.0414033,5.0432673,5.0451274,5.0469847,5.048838,5.0506883,5.052535,5.054378,5.056218,5.0580544,5.059888,5.0617175,5.063544,5.0653667,5.067187,5.069003,5.0708165,5.0726266,5.074433,5.0762362,5.078037,5.0798335,5.0816274,5.0834174,5.0852046,5.086989,5.08877,5.0905476,5.0923223,5.094094,5.095862,5.097627,5.099389,5.101148,5.102904,5.1046567,5.1064067,5.1081533,5.1098967,5.1116376,5.113375,5.1151094,5.1168413,5.11857,5.1202955,5.122018,5.123738,5.1254544,5.127168,5.128879,5.1305866,5.132292,5.133994,5.135693,5.137389,5.139083,5.1407733,5.1424613,5.144146,5.1458282,5.147507,5.1491838,5.1508574,5.1525283,5.1541963,5.1558614,5.1575236,5.1591835,5.1608405,5.1624947,5.164146,5.165795,5.167441,5.1690845,5.170725,5.172363,5.1739984,5.175631,5.177261,5.178888,5.1805124,5.1821346,5.183754,5.185371,5.186985,5.1885967,5.1902056,5.191812,5.1934156,5.195017,5.1966157,5.1982117,5.1998053,5.2013965,5.202985,5.204571,5.2061543,5.2077355,5.209314,5.21089,5.2124634,5.2140346,5.215603,5.2171693,5.218733,5.220294,5.221853,5.223409,5.224963,5.226515,5.228064,5.2296104,5.231155,5.232697,5.2342367,5.235774,5.237309,5.238841,5.240371,5.2418995,5.243425,5.244948,5.246469,5.2479873,5.2495036,5.2510176,5.252529,5.254039,5.2555456,5.2570505,5.258553,5.2600536,5.2615514,5.2630477,5.264541,5.2660327,5.267522,5.2690086,5.2704935,5.271976,5.273456,5.2749343,5.27641,5.277884,5.2793555,5.280825,5.2822924,5.2837577,5.2852206,5.2866817,5.2881403,5.289597,5.2910514,5.292504,5.293954,5.295402,5.2968483,5.298292],"x":[28.0,28.144289,28.288578,28.432865,28.577154,28.721443,28.865732,29.01002,29.154308,29.298597,29.442886,29.587173,29.731462,29.875751,30.02004,30.16433,30.308617,30.452906,30.597195,30.741484,30.88577,31.03006,31.174349,31.318638,31.462925,31.607214,31.751503,31.895792,32.04008,32.18437,32.32866,32.472946,32.617233,32.761524,32.90581,33.0501,33.19439,33.338676,33.482967,33.627254,33.77154,33.915833,34.06012,34.20441,34.348698,34.492985,34.637276,34.781563,34.92585,35.07014,35.214428,35.35872,35.503006,35.647293,35.791584,35.93587,36.080162,36.22445,36.368736,36.513027,36.657314,36.8016,36.945892,37.09018,37.23447,37.378757,37.523045,37.667336,37.811623,37.955914,38.1002,38.244488,38.38878,38.533066,38.677353,38.821644,38.96593,39.11022,39.25451,39.398796,39.543087,39.687374,39.831665,39.975952,40.12024,40.26453,40.408817,40.553104,40.697395,40.841682,40.985973,41.13026,41.274548,41.41884,41.563126,41.707417,41.851704,41.99599,42.14028,42.28457,42.428856,42.573147,42.717434,42.861725,43.006012,43.1503,43.29459,43.438877,43.583168,43.727455,43.871742,44.016033,44.16032,44.304607,44.4489,44.593185,44.737476,44.881763,45.02605,45.17034,45.31463,45.45892,45.603207,45.747494,45.891785,46.03607,46.18036,46.32465,46.468937,46.613228,46.757515,46.901802,47.046093,47.19038,47.33467,47.47896,47.623245,47.767536,47.911823,48.05611,48.2004,48.34469,48.48898,48.633266,48.777554,48.921844,49.06613,49.210423,49.35471,49.498997,49.643288,49.787575,49.93186,50.076153,50.22044,50.36473,50.509018,50.653305,50.797596,50.941883,51.086174,51.23046,51.37475,51.51904,51.663326,51.807613,51.951904,52.09619,52.240482,52.38477,52.529057,52.673347,52.817635,52.961926,53.106213,53.2505,53.39479,53.539078,53.683365,53.827656,53.971943,54.116234,54.26052,54.404808,54.5491,54.693386,54.837677,54.981964,55.12625,55.270542,55.41483,55.559116,55.703407,55.847694,55.991985,56.136272,56.28056,56.42485,56.569138,56.71343,56.857716,57.002003,57.146294,57.29058,57.434868,57.57916,57.723446,57.867737,58.012024,58.15631,58.300602,58.44489,58.58918,58.733467,58.877754,59.022045,59.166332,59.31062,59.45491,59.599197,59.74349,59.887775,60.032063,60.176353,60.32064,60.46493,60.60922,60.753506,60.897797,61.042084,61.18637,61.33066,61.47495,61.61924,61.763527,61.907814,62.052105,62.196392,62.340683,62.48497,62.629257,62.77355,62.917835,63.062122,63.206413,63.3507,63.49499,63.63928,63.783566,63.927856,64.07214,64.21643,64.36072,64.50501,64.6493,64.79359,64.937874,65.08216,65.226456,65.37074,65.51503,65.65932,65.803604,65.9479,66.092186,66.23647,66.38076,66.52505,66.66934,66.81363,66.95792,67.1022,67.24649,67.390785,67.53507,67.67936,67.82365,67.96793,68.11222,68.256516,68.4008,68.54509,68.68938,68.833664,68.97796,69.122246,69.26653,69.41082,69.55511,69.6994,69.84369,69.987976,70.13226,70.27655,70.420845,70.56513,70.70942,70.85371,70.99799,71.14229,71.286575,71.43086,71.57515,71.71944,71.86372,72.00802,72.152306,72.29659,72.44088,72.58517,72.72946,72.87375,73.018036,73.16232,73.30661,73.450905,73.59519,73.73948,73.883766,74.02805,74.17235,74.316635,74.46092,74.60521,74.7495,74.89379,75.03808,75.182365,75.32665,75.47094,75.61523,75.75952,75.90381,76.048096,76.19238,76.33667,76.480965,76.62525,76.76954,76.913826,77.05811,77.20241,77.346695,77.49098,77.63527,77.77956,77.92385,78.06814,78.212425,78.35671,78.501,78.645294,78.78958,78.93387,79.078156,79.22244,79.36673,79.511024,79.65531,79.7996,79.943886,80.08817,80.23247,80.376755,80.52104,80.66533,80.809616,80.95391,81.0982,81.242485,81.38677,81.53106,81.675354,81.81964,81.96393,82.108215,82.2525,82.3968,82.541084,82.68537,82.82966,82.973946,83.11823,83.26253,83.406815,83.5511,83.69539,83.839676,83.98397,84.12826,84.272545,84.41683,84.56112,84.705414,84.8497,84.99399,85.138275,85.28256,85.42686,85.571144,85.71543,85.85972,86.004005,86.1483,86.29259,86.436874,86.58116,86.72545,86.869736,87.01403,87.15832,87.302605,87.44689,87.59118,87.73547,87.87976,88.02405,88.168335,88.31262,88.45692,88.601204,88.74549,88.88978,89.034065,89.17836,89.32265,89.466934,89.61122,89.75551,89.8998,90.04409,90.18838,90.332664,90.47695,90.62124,90.76553,90.90982,91.05411,91.198395,91.34268,91.48698,91.63126,91.77555,91.91984,92.064125,92.20842,92.35271,92.496994,92.64128,92.78557,92.92986,93.07415,93.21844,93.362724,93.50701,93.651306,93.79559,93.93988,94.08417,94.228455,94.37274,94.51704,94.66132,94.80561,94.9499,95.094185,95.23848,95.38277,95.527054,95.67134,95.81563,95.95992,96.10421,96.2485,96.392784,96.53707,96.681366,96.82565,96.96994,97.11423,97.258514,97.40281,97.5471,97.69138,97.83567,97.97996,98.124245,98.26854,98.41283,98.55711,98.7014,98.84569,98.98998,99.13427,99.27856,99.422844,99.56713,99.711426,99.85571,100.0]} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/medium_positive.json b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/medium_positive.json new file mode 100644 index 000000000000..685c57433c35 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/medium_positive.json @@ -0,0 +1 @@ +{"expected":[0.0,0.08950285,0.12653303,0.1549195,0.1788264,0.19986723,0.21887128,0.23632997,0.25256357,0.26779595,0.28218886,0.29586455,0.3089191,0.32142788,0.33345202,0.34504288,0.3562425,0.3670864,0.37760592,0.38782716,0.39777318,0.40746388,0.41691762,0.42615002,0.43517488,0.44400537,0.45265272,0.461127,0.46943805,0.47759426,0.48560318,0.4934725,0.50120854,0.50881726,0.51630473,0.5236759,0.5309356,0.53808856,0.54513896,0.5520905,0.5589473,0.5657127,0.5723896,0.57898164,0.5854914,0.59192157,0.59827495,0.6045539,0.61076057,0.6168974,0.62296647,0.62896943,0.6349086,0.64078563,0.64660203,0.6523598,0.65806025,0.6637048,0.6692952,0.67483264,0.6803184,0.68575364,0.6911398,0.696478,0.7017692,0.7070145,0.7122152,0.71737176,0.7224858,0.7275578,0.7325886,0.7375793,0.74253064,0.7474433,0.7523184,0.7571563,0.76195776,0.7667238,0.7714549,0.7761514,0.78081447,0.7854445,0.7900419,0.7946076,0.79914194,0.8036454,0.8081187,0.8125623,0.81697655,0.82136214,0.8257195,0.83004886,0.834351,0.8386262,0.8428748,0.84709746,0.85129434,0.8554659,0.8596124,0.86373454,0.8678325,0.8719064,0.87595695,0.8799843,0.8839888,0.8879709,0.89193076,0.8958686,0.899785,0.90368015,0.9075541,0.9114074,0.9152403,0.91905284,0.92284566,0.9266187,0.93037224,0.9341067,0.9378222,0.9415189,0.9451973,0.94885737,0.9524993,0.95612353,0.95973015,0.9633193,0.96689135,0.9704464,0.97398454,0.97750616,0.98101145,0.98450035,0.9879733,0.9914304,0.9948717,0.9982975,1.001708,1.0051033,1.0084835,1.011849,1.0151997,1.0185357,1.0218575,1.0251651,1.0284584,1.0317377,1.0350033,1.0382551,1.0414935,1.0447184,1.04793,1.0511285,1.054314,1.0574864,1.0606463,1.0637934,1.0669279,1.0700501,1.07316,1.0762577,1.0793433,1.082417,1.0854788,1.0885289,1.0915673,1.0945941,1.0976096,1.1006138,1.1036067,1.1065885,1.1095592,1.112519,1.1154679,1.1184062,1.1213338,1.1242507,1.1271572,1.1300534,1.1329392,1.1358148,1.1386802,1.1415355,1.144381,1.1472166,1.1500423,1.1528584,1.1556647,1.1584615,1.1612488,1.1640265,1.166795,1.1695542,1.1723043,1.1750451,1.1777769,1.1804998,1.1832136,1.1859187,1.188615,1.1913023,1.1939812,1.1966515,1.1993132,1.2019664,1.2046112,1.2072476,1.2098758,1.2124958,1.2151076,1.2177112,1.2203069,1.2228943,1.2254741,1.2280458,1.2306098,1.233166,1.2357144,1.2382553,1.2407883,1.2433139,1.2458321,1.2483426,1.2508459,1.2533417,1.2558302,1.2583115,1.2607856,1.2632524,1.2657123,1.2681649,1.2706105,1.2730492,1.2754809,1.2779057,1.2803236,1.2827349,1.2851393,1.287537,1.289928,1.2923124,1.2946901,1.2970614,1.2994261,1.3017844,1.3041362,1.3064816,1.3088207,1.3111534,1.3134799,1.3158001,1.318114,1.3204219,1.3227237,1.3250194,1.327309,1.3295926,1.3318701,1.3341417,1.3364075,1.3386674,1.3409214,1.3431696,1.3454119,1.3476486,1.3498795,1.3521049,1.3543245,1.3565385,1.3587469,1.3609496,1.363147,1.3653389,1.3675255,1.3697064,1.371882,1.374052,1.3762169,1.3783765,1.3805307,1.3826798,1.3848236,1.386962,1.3890954,1.3912238,1.393347,1.395465,1.3975781,1.3996859,1.401789,1.4038869,1.40598,1.4080681,1.4101514,1.4122295,1.4143031,1.4163716,1.4184355,1.4204947,1.4225489,1.4245985,1.4266433,1.4286835,1.4307189,1.4327499,1.4347762,1.4367979,1.4388149,1.4408275,1.4428356,1.4448391,1.4468383,1.4488329,1.450823,1.4528087,1.4547902,1.4567672,1.4587399,1.4607083,1.4626722,1.464632,1.4665875,1.4685388,1.4704859,1.4724287,1.4743673,1.4763017,1.478232,1.4801582,1.4820803,1.4839983,1.4859122,1.487822,1.489728,1.4916298,1.4935278,1.4954215,1.4973114,1.4991974,1.5010794,1.5029576,1.5048319,1.5067023,1.5085688,1.5104314,1.5122904,1.5141455,1.5159967,1.5178443,1.5196881,1.521528,1.5233644,1.525197,1.5270259,1.5288513,1.5306729,1.5324907,1.5343052,1.536116,1.5379232,1.5397267,1.5415268,1.5433233,1.5451163,1.5469056,1.5486916,1.5504742,1.552253,1.5540285,1.5558007,1.5575694,1.5593346,1.5610965,1.562855,1.56461,1.5663618,1.5681102,1.5698553,1.5715971,1.5733356,1.5750706,1.5768026,1.5785313,1.5802567,1.5819788,1.5836978,1.5854136,1.587126,1.5888354,1.5905416,1.5922446,1.5939445,1.5956413,1.5973347,1.5990252,1.6007128,1.6023971,1.6040784,1.6057566,1.6074317,1.6091038,1.610773,1.612439,1.6141021,1.6157622,1.6174194,1.6190735,1.6207247,1.622373,1.6240183,1.6256608,1.6273001,1.6289368,1.6305705,1.6322013,1.6338294,1.6354544,1.6370766,1.6386962,1.6403128,1.6419265,1.6435375,1.6451458,1.646751,1.6483538,1.6499536,1.6515508,1.6531453,1.654737,1.6563259,1.657912,1.6594956,1.6610765,1.6626546,1.6642301,1.665803,1.6673731,1.6689407,1.6705055,1.6720679,1.6736275,1.6751846,1.676739,1.6782908,1.6798402,1.6813868,1.6829311,1.6844727,1.6860117,1.6875483,1.6890823,1.6906137,1.6921428,1.6936693,1.6951933,1.6967148,1.6982338,1.6997504,1.7012646,1.7027763,1.7042855,1.7057923,1.7072967,1.7087988,1.7102983,1.7117954,1.7132903,1.7147827,1.7162727,1.7177604,1.7192458,1.7207288,1.7222093,1.7236875,1.7251636,1.7266372,1.7281086,1.7295777,1.7310444,1.7325088,1.733971,1.7354308,1.7368885,1.738344,1.7397971,1.7412479,1.7426966,1.744143,1.7455872,1.7470293,1.7484691,1.7499067,1.751342,1.7527753,1.7542063,1.7556353,1.7570618,1.7584864,1.7599088,1.761329,1.7627472],"x":[1.0,1.004008,1.008016,1.012024,1.0160321,1.02004,1.0240481,1.0280561,1.0320641,1.0360721,1.0400802,1.0440881,1.0480962,1.0521042,1.0561122,1.0601202,1.0641283,1.0681362,1.0721443,1.0761523,1.0801604,1.0841683,1.0881764,1.0921844,1.0961924,1.1002004,1.1042085,1.1082164,1.1122245,1.1162325,1.1202404,1.1242485,1.1282566,1.1322645,1.1362725,1.1402806,1.1442885,1.1482966,1.1523046,1.1563126,1.1603206,1.1643287,1.1683366,1.1723447,1.1763527,1.1803607,1.1843687,1.1883768,1.1923847,1.1963928,1.2004008,1.2044088,1.2084168,1.2124249,1.2164328,1.2204409,1.2244489,1.2284569,1.2324649,1.236473,1.240481,1.244489,1.248497,1.2525051,1.256513,1.260521,1.2645291,1.268537,1.2725451,1.2765532,1.2805611,1.2845691,1.2885772,1.2925851,1.2965932,1.3006012,1.3046092,1.3086172,1.3126253,1.3166332,1.3206413,1.3246493,1.3286573,1.3326653,1.3366734,1.3406813,1.3446894,1.3486974,1.3527054,1.3567134,1.3607215,1.3647294,1.3687375,1.3727455,1.3767534,1.3807615,1.3847696,1.3887776,1.3927855,1.3967936,1.4008017,1.4048096,1.4088176,1.4128257,1.4168336,1.4208417,1.4248497,1.4288577,1.4328657,1.4368738,1.4408817,1.4448898,1.4488978,1.4529058,1.4569138,1.4609219,1.4649298,1.4689379,1.4729459,1.4769539,1.4809619,1.48497,1.4889779,1.492986,1.496994,1.501002,1.50501,1.5090181,1.513026,1.517034,1.5210421,1.52505,1.5290581,1.5330662,1.5370741,1.5410821,1.5450902,1.5490983,1.5531062,1.5571142,1.5611223,1.5651302,1.5691383,1.5731463,1.5771543,1.5811623,1.5851704,1.5891783,1.5931864,1.5971944,1.6012024,1.6052104,1.6092185,1.6132264,1.6172345,1.6212425,1.6252505,1.6292585,1.6332666,1.6372745,1.6412826,1.6452906,1.6492985,1.6533066,1.6573147,1.6613226,1.6653306,1.6693387,1.6733466,1.6773547,1.6813627,1.6853707,1.6893787,1.6933868,1.6973948,1.7014028,1.7054108,1.7094189,1.7134268,1.7174349,1.7214429,1.7254509,1.7294589,1.733467,1.7374749,1.741483,1.745491,1.749499,1.753507,1.7575151,1.761523,1.7655311,1.7695391,1.773547,1.7775551,1.7815632,1.7855711,1.7895792,1.7935872,1.7975951,1.8016032,1.8056113,1.8096192,1.8136272,1.8176353,1.8216432,1.8256513,1.8296593,1.8336673,1.8376753,1.8416834,1.8456913,1.8496994,1.8537074,1.8577155,1.8617234,1.8657315,1.8697395,1.8737475,1.8777555,1.8817636,1.8857715,1.8897796,1.8937876,1.8977956,1.9018036,1.9058117,1.9098196,1.9138277,1.9178357,1.9218436,1.9258517,1.9298598,1.9338677,1.9378757,1.9418838,1.9458917,1.9498998,1.9539078,1.9579158,1.9619238,1.9659319,1.9699398,1.9739479,1.9779559,1.9819639,1.9859719,1.98998,1.9939879,1.997996,2.002004,2.006012,2.01002,2.014028,2.0180361,2.0220442,2.026052,2.03006,2.034068,2.0380762,2.0420842,2.0460923,2.0501,2.0541081,2.0581162,2.0621243,2.0661323,2.0701404,2.0741482,2.0781562,2.0821643,2.0861723,2.0901804,2.0941885,2.0981965,2.1022043,2.1062124,2.1102204,2.1142285,2.1182365,2.1222446,2.1262524,2.1302605,2.1342685,2.1382766,2.1422846,2.1462927,2.1503005,2.1543086,2.1583166,2.1623247,2.1663327,2.1703408,2.1743486,2.1783566,2.1823647,2.1863728,2.1903808,2.1943889,2.1983967,2.2024047,2.2064128,2.2104208,2.214429,2.218437,2.2224448,2.2264528,2.230461,2.234469,2.238477,2.242485,2.246493,2.250501,2.254509,2.258517,2.262525,2.2665331,2.2705412,2.274549,2.278557,2.282565,2.2865732,2.2905812,2.2945893,2.298597,2.3026052,2.3066132,2.3106213,2.3146293,2.3186374,2.3226452,2.3266532,2.3306613,2.3346694,2.3386774,2.3426855,2.3466933,2.3507013,2.3547094,2.3587174,2.3627255,2.3667336,2.3707414,2.3747494,2.3787575,2.3827655,2.3867736,2.3907816,2.3947897,2.3987975,2.4028056,2.4068136,2.4108217,2.4148297,2.4188378,2.4228456,2.4268537,2.4308617,2.4348698,2.4388778,2.4428859,2.4468937,2.4509017,2.4549098,2.4589179,2.462926,2.466934,2.4709418,2.4749498,2.478958,2.482966,2.486974,2.490982,2.4949899,2.498998,2.503006,2.507014,2.511022,2.5150301,2.519038,2.523046,2.527054,2.5310621,2.5350702,2.5390782,2.5430863,2.547094,2.5511022,2.5551102,2.5591183,2.5631263,2.5671344,2.5711422,2.5751503,2.5791583,2.5831664,2.5871744,2.5911825,2.5951903,2.5991983,2.6032064,2.6072145,2.6112225,2.6152306,2.6192384,2.6232464,2.6272545,2.6312625,2.6352706,2.6392787,2.6432865,2.6472945,2.6513026,2.6553106,2.6593187,2.6633267,2.6673346,2.6713426,2.6753507,2.6793587,2.6833668,2.6873748,2.6913826,2.6953907,2.6993988,2.7034068,2.7074149,2.711423,2.715431,2.7194388,2.7234468,2.727455,2.731463,2.735471,2.739479,2.743487,2.747495,2.751503,2.755511,2.759519,2.7635272,2.767535,2.771543,2.775551,2.7795591,2.7835672,2.7875752,2.791583,2.795591,2.7995992,2.8036072,2.8076153,2.8116233,2.8156312,2.8196392,2.8236473,2.8276553,2.8316634,2.8356714,2.8396792,2.8436873,2.8476954,2.8517034,2.8557115,2.8597195,2.8637276,2.8677354,2.8717434,2.8757515,2.8797596,2.8837676,2.8877757,2.8917835,2.8957915,2.8997996,2.9038076,2.9078157,2.9118237,2.9158316,2.9198396,2.9238477,2.9278557,2.9318638,2.9358718,2.9398797,2.9438877,2.9478958,2.9519038,2.9559119,2.95992,2.9639277,2.9679358,2.9719439,2.975952,2.97996,2.983968,2.9879758,2.991984,2.995992,3.0]} diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/runner.jl b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/runner.jl new file mode 100644 index 000000000000..2e2c00053842 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/fixtures/julia/runner.jl @@ -0,0 +1,74 @@ +#!/usr/bin/env julia +# +# @license Apache-2.0 +# +# Copyright (c) 2018 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import JSON + +""" + gen( domain, name ) + +Generate fixture data and write to file. + +# Arguments + +* `domain`: domain +* `name::AbstractString`: output filename + +# Examples + +``` julia +julia> x = range( -1000, stop = 1000, length = 2001 ); +julia> gen( x, \"data.json\" ); +``` +""" +function gen( domain, name ) + x = collect( domain ); + y = acosh.( x ); + + # Store data to be written to file as a collection: + data = Dict([ + ("x", x), + ("expected", y) + ]); + + # Based on the script directory, create an output filepath: + filepath = joinpath( dir, name ); + + # Write the data to the output filepath as JSON: + outfile = open( filepath, "w" ); + write( outfile, JSON.json(data) ); + write( outfile, "\n" ); + close( outfile ); +end + +# Get the filename: +file = @__FILE__; + +# Extract the directory in which this file resides: +dir = dirname( file ); + +# Positive medium values: +x = range( 1.0f0, stop = 3.0f0, length = 500 ); +gen( x, "medium_positive.json" ); + +# Large positive values: +x = range( 3.0f0, stop = 28.0f0, length = 500 ); +gen( x, "large_positive.json" ); + +# Larger positive values: +x = range( 28.0f0, stop = 100.0f0, length = 500 ); +gen( x, "larger_positive.json" ); diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.js b/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.js new file mode 100644 index 000000000000..052e67c60377 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.js @@ -0,0 +1,140 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var randu = require( '@stdlib/random/base/randu' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var absf = require( '@stdlib/math/base/special/absf' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var acoshf = require( './../lib' ); + + +// FIXTURES // + +var largerPositive = require( './fixtures/julia/larger_positive.json' ); +var largePositive = require( './fixtures/julia/large_positive.json' ); +var mediumPositive = require( './fixtures/julia/medium_positive.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.true( typeof acoshf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [1.0,3.0]', function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = mediumPositive.x; + expected = mediumPositive.expected; + + for ( i = 0; i < x.length; i++ ) { + y = acoshf( x[i] ); + e = float64ToFloat32( expected[ i ] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = absf( y - e ); + tol = 1.0 * EPS * absf( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [3.0,28.0]', function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = largePositive.x; + expected = largePositive.expected; + + for ( i = 0; i < x.length; i++ ) { + y = acoshf( x[i] ); + e = float64ToFloat32( expected[ i ] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = absf( y - e ); + tol = 1.0 * EPS * absf( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [28.0,100.0]', function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = largerPositive.x; + expected = largerPositive.expected; + + for ( i = 0; i < x.length; i++ ) { + y = acoshf( x[i] ); + e = float64ToFloat32( expected[ i ] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = absf( y - e ); + tol = 1.0 * EPS * absf( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { + var v = acoshf( NaN ); + t.equal( isnanf( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `NaN` if provided value less than `1`', function test( t ) { + var v; + var i; + + for ( i = 0; i < 1e3; i++ ) { + v = -(randu()*1.0e6) + (1-EPS); + t.equal( isnanf( acoshf( v ) ), true, 'returns expected value when provided '+v ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.native.js new file mode 100644 index 000000000000..b3b655e5826b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/acoshf/test/test.native.js @@ -0,0 +1,149 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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 randu = require( '@stdlib/random/base/randu' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// FIXTURES // + +var largerPositive = require( './fixtures/julia/larger_positive.json' ); +var largePositive = require( './fixtures/julia/large_positive.json' ); +var mediumPositive = require( './fixtures/julia/medium_positive.json' ); + + +// VARIABLES // + +var acoshf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( acoshf instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.true( typeof acoshf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [1.0,3.0]', opts, function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = mediumPositive.x; + expected = mediumPositive.expected; + + for ( i = 0; i < x.length; i++ ) { + y = acoshf( x[i] ); + e = float64ToFloat32( expected[ i ] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = abs( y - e ); + tol = 1.0 * EPS * abs( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [3.0,28.0]', opts, function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = largePositive.x; + expected = largePositive.expected; + + for ( i = 0; i < x.length; i++ ) { + e = float64ToFloat32( expected[ i ] ); + y = acoshf( x[i] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = abs( y - e ); + tol = 1.0 * EPS * abs( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function computes the hyperbolic arccosine on the interval [28.0,100.0]', opts, function test( t ) { + var expected; + var delta; + var tol; + var e; + var x; + var y; + var i; + + x = largerPositive.x; + expected = largerPositive.expected; + + for ( i = 0; i < x.length; i++ ) { + y = acoshf( x[i] ); + e = float64ToFloat32( expected[ i ] ); + if ( y === e ) { + t.equal( y, e, 'x: '+x[i]+'. E: '+e ); + } else { + delta = abs( y - e ); + tol = 1.0 * EPS * abs( e ); + t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+e+'. tol: '+tol+'. Δ: '+delta+'.' ); + } + } + t.end(); +}); + +tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { + var v = acoshf( NaN ); + t.equal( isnan( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `NaN` if provided value less than `1`', opts, function test( t ) { + var v; + var i; + + for ( i = 0; i < 1e3; i++ ) { + v = -(randu()*1.0e6) + (1-EPS); + t.equal( isnan( acoshf( v ) ), true, 'returns expected value when provided '+v ); + } + t.end(); +});