From 1b17c24c95a53913f9fc16cdc2aa4f3e74f1a7a5 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Mon, 19 May 2025 23:48:20 -0700 Subject: [PATCH 1/5] feat: add `math/base/special/spencef` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: passed - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/spencef/LICENSE | 196 ++++++++++++++++ .../math/base/special/spencef/README.md | 212 ++++++++++++++++++ .../special/spencef/benchmark/benchmark.js | 54 +++++ .../spencef/benchmark/benchmark.native.js | 63 ++++++ .../spencef/benchmark/c/native/Makefile | 146 ++++++++++++ .../spencef/benchmark/c/native/benchmark.c | 136 +++++++++++ .../math/base/special/spencef/binding.gyp | 170 ++++++++++++++ .../math/base/special/spencef/docs/repl.txt | 29 +++ .../special/spencef/docs/types/index.d.ts | 48 ++++ .../base/special/spencef/docs/types/test.ts | 44 ++++ .../base/special/spencef/examples/c/Makefile | 146 ++++++++++++ .../base/special/spencef/examples/c/example.c | 31 +++ .../base/special/spencef/examples/index.js | 30 +++ .../math/base/special/spencef/include.gypi | 53 +++++ .../stdlib/math/base/special/spencef.h | 38 ++++ .../math/base/special/spencef/lib/index.js | 49 ++++ .../math/base/special/spencef/lib/main.js | 131 +++++++++++ .../math/base/special/spencef/lib/native.js | 58 +++++ .../base/special/spencef/lib/polyval_a.js | 47 ++++ .../base/special/spencef/lib/polyval_b.js | 47 ++++ .../math/base/special/spencef/manifest.json | 75 +++++++ .../math/base/special/spencef/package.json | 69 ++++++ .../base/special/spencef/scripts/evalpoly.js | 142 ++++++++++++ .../math/base/special/spencef/src/Makefile | 70 ++++++ .../math/base/special/spencef/src/addon.c | 22 ++ .../math/base/special/spencef/src/main.c | 148 ++++++++++++ .../spencef/test/fixtures/python/large.json | 1 + .../spencef/test/fixtures/python/medium.json | 1 + .../spencef/test/fixtures/python/runner.py | 77 +++++++ .../spencef/test/fixtures/python/small.json | 1 + .../math/base/special/spencef/test/test.js | 134 +++++++++++ .../base/special/spencef/test/test.native.js | 145 ++++++++++++ 32 files changed, 2613 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/LICENSE create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/README.md create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/include/stdlib/math/base/special/spencef.h create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_a.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_b.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/package.json create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/large.json create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/medium.json create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/small.json create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/test.js create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/LICENSE b/lib/node_modules/@stdlib/math/base/special/spencef/LICENSE new file mode 100644 index 000000000000..3e825d2f4fbe --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/LICENSE @@ -0,0 +1,196 @@ + + 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: + +* Cephes + +Copyright (c) 1984-2000 Stephen L. Moshier + +Some software in this archive may be from the book _Methods and Programs for +Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) +or from the Cephes Mathematical Library, a commercial product. In either event, +it is copyrighted by the author. What you see here may be used freely but it +comes with no support or guarantee. + +Stephen L. Moshier +moshier@na-net.ornl.gov diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/README.md b/lib/node_modules/@stdlib/math/base/special/spencef/README.md new file mode 100644 index 000000000000..881429a896f8 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/README.md @@ -0,0 +1,212 @@ + + +# spencef + +> [Spence's function][spence] (the dilogarithm) for a single-precision floating-point number. + +
+ +The dilogarithm is defined as + + + +```math +\mathop{\mathrm{Li}}_{2}(z) = -\int_{0}^{z}{\ln(1-u) \over u}\,du{\text{, }}z\in \mathbb {C} +``` + + + +or also alternatively as + + + +```math +\int _{1}^{v}{\frac {\ln t}{1-t}}dt=\operatorname {Li} _{2}(1-v). +``` + + + +
+ + + +
+ +## Usage + +```javascript +var spencef = require( '@stdlib/math/base/special/spencef' ); +``` + +#### spencef( x ) + +Evaluates [Spence's function][spence] (the dilogarithm) for a single-precision floating-point number. + +```javascript +var v = spencef( 3.0 ); +// returns ~-1.437 + +v = spencef( 0.0 ); +// returns ~1.645 + +v = spencef( NaN ); +// returns NaN +``` + +For negative numbers, the dilogarithm is **not** defined. + +```javascript +var v = spencef( -4.0 ); +// returns NaN +``` + +
+ + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var spencef = require( '@stdlib/math/base/special/spencef' ); + +var opts = { + 'dtype': 'float32' +}; +var x = uniform( 100, 0.0, 100.0, opts ); + +logEachMap( 'spencef(%0.4f) = %0.4f', x, spencef ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/spencef.h" +``` + +#### stdlib_base_spencef( x ) + +Evaluates [Spence's function][spence] (the dilogarithm) for a single-precision floating-point number. + +```c +float out = stdlib_base_spencef( 3.0f ); +// returns ~-1.437f + +out = stdlib_base_spencef( 0.0f ); +// returns ~1.645f +``` + +The function accepts the following arguments: + +- **x**: `[in] float` input value. + +```c +float stdlib_base_spencef( const float x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/spencef.h" +#include + +int main( void ) { + const float x[] = { 3.0f, 9.0f, 0.0f, -10.0f }; + + float y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_spencef( x[ i ] ); + printf( "spencef(%f) = %f\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js new file mode 100644 index 000000000000..9e76c24c4abe --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var 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 spencef = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, 0.0, 1000.0, { + 'dtype': 'float32' + }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = spencef( 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/spencef/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js new file mode 100644 index 000000000000..1006c147ab17 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js @@ -0,0 +1,63 @@ +/** +* @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/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 spencef = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( spencef instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var x; + var y; + var i; + + x = uniform( 100, 0.0, 1000.0, { + 'dtype': 'float32' + }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = spencef( 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/spencef/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile new file mode 100644 index 000000000000..f69e9da2b4d3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c new file mode 100644 index 000000000000..24b674da3a11 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c @@ -0,0 +1,136 @@ +/** +* @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/spencef.h" +#include +#include +#include +#include +#include + +#define NAME "spencef" +#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 ) { + float x[ 100 ]; + double elapsed; + double t; + float y; + int i; + + for ( i = 0; i < 100; i++ ) { + x[ i ] = 1000.0f * rand_float(); + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_spencef( 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::native::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp b/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp new file mode 100644 index 000000000000..ec3992233442 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2024 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/spencef/docs/repl.txt new file mode 100644 index 000000000000..a7a964bc9982 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( x ) + Evaluates Spence's function (the dilogarithm) for a single-precision + floating-point number. + + Parameters + ---------- + x: number + Input value. + + Returns + ------- + y: number + Function value. + + Examples + -------- + > var y = {{alias}}( 3.0 ) + ~-1.437 + > y = {{alias}}( 0.0 ) + ~1.645 + > y = {{alias}}( -9.0 ) + NaN + > y = {{alias}}( NaN ) + NaN + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts new file mode 100644 index 000000000000..ca00bb57a30d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts @@ -0,0 +1,48 @@ +/* +* @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 + +/** +* Evaluates Spence's function (the dilogarithm) for a single-precision floating-point number. +* +* @param x - input value +* @returns function value +* +* @example +* var v = spencef( 3.0 ); +* // returns ~-1.437 +* +* @example +* var v = spencef( 0.0 ); +* // returns ~1.645 +* +* @example +* var v = spencef( -9.0 ); +* // returns NaN +* +* @example +* var v = spencef( NaN ); +* // returns NaN +*/ +declare function spencef( x: number ): number; + + +// EXPORTS // + +export = spencef; diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts new file mode 100644 index 000000000000..7a3e502c445d --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/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 spencef = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + spencef( 2 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a value other than a number... +{ + spencef( true ); // $ExpectError + spencef( false ); // $ExpectError + spencef( null ); // $ExpectError + spencef( undefined ); // $ExpectError + spencef( '5' ); // $ExpectError + spencef( [] ); // $ExpectError + spencef( {} ); // $ExpectError + spencef( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + spencef(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile new file mode 100644 index 000000000000..6aed70daf167 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2024 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c new file mode 100644 index 000000000000..72a5ae66198b --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c @@ -0,0 +1,31 @@ +/** +* @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/spencef.h" +#include + +int main( void ) { + const float x[] = { 3.0f, 9.0f, 0.0f, -10.0f }; + + float y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_spencef( x[ i ] ); + printf( "spencef(%f) = %f\n", x[ i ], y ); + } +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js b/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js new file mode 100644 index 000000000000..b5a0b4b870ab --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var spencef = require( './../lib' ); + +var opts = { + 'dtype': 'float32' +}; +var x = uniform( 100, 0.0, 100.0, opts ); + +logEachMap( 'spencef(%0.4f) = %0.4f', x, spencef ); diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi b/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi new file mode 100644 index 000000000000..575cb043c0bf --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2024 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + ' 2.0 ) { + x = float64ToFloat32( 1.0 / float64ToFloat32( x ) ); + flg |= 2; + } + if ( x > 1.5 ) { + w = float64ToFloat32( 1.0 / float64ToFloat32( x ) ) - 1.0; + flg |= 2; + } else if ( x < 0.5 ) { + w = float64ToFloat32( -x ); + flg |= 1; + } else { + w = float64ToFloat32( x ) - 1.0; + } + // eslint-disable-next-line max-len + y = float64ToFloat32( -w * float64ToFloat32( polyvalA( w )/polyvalB( w ) ) ); + if ( flg & 1 ) { + // eslint-disable-next-line max-len + y = float64ToFloat32( PI2O6 - float64ToFloat32( lnf( x )*lnf( 1.0-x ) ) - y ); + } + if ( flg & 2 ) { + z = lnf( x ); + y = -float64ToFloat32( float64ToFloat32( 0.5*z*z ) + y ); + } + return y; +} + + +// EXPORTS // + +module.exports = spencef; diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js new file mode 100644 index 000000000000..13995b280e4e --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/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 addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Evaluates Spence's function (the dilogarithm) for a single-precision floating-point number. +* +* @private +* @param {NonNegativeNumber} x - input value +* @returns {number} function value +* +* @example +* var v = spencef( 3.0 ); +* // returns ~-1.437 +* +* @example +* var v = spencef( 0.0 ); +* // returns ~1.645 +* +* @example +* var v = spencef( -9.0 ); +* // returns NaN +* +* @example +* var v = spencef( NaN ); +* // returns NaN +*/ +function spencef( x ) { + return addon( x ); +} + + +// EXPORTS // + +module.exports = spencef; diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_a.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_a.js new file mode 100644 index 000000000000..cc2ca604b018 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_a.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 1.0; + } + return 1.0 + (x * (3.297713409852251 + (x * (4.256971560081218 + (x * (2.7114985119655346 + (x * (0.8796913117545303 + (x * (0.13384763957830903 + (x * (0.007315890452380947 + (x * 0.000046512858607399003))))))))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_b.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_b.js new file mode 100644 index 000000000000..4d6fb4f638cb --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/polyval_b.js @@ -0,0 +1,47 @@ +/** +* @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. +*/ + +/* This is a generated file. Do not edit directly. */ +'use strict'; + +// MAIN // + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @private +* @param {number} x - value at which to evaluate the polynomial +* @returns {number} evaluated polynomial +*/ +function evalpoly( x ) { + if ( x === 0.0 ) { + return 1.0; + } + return 1.0 + (x * (3.547713409852251 + (x * (5.03278880143317 + (x * (3.6380053334513707 + (x * (1.4117259775183106 + (x * (0.2829748606025681 + (x * (0.02540437639325444 + (x * 0.0006909904889125533))))))))))))); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = evalpoly; diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/manifest.json b/lib/node_modules/@stdlib/math/base/special/spencef/manifest.json new file mode 100644 index 000000000000..20e813e8f4cb --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/manifest.json @@ -0,0 +1,75 @@ +{ + "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/lnf" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/special/lnf" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nanf", + "@stdlib/math/base/special/lnf" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/package.json b/lib/node_modules/@stdlib/math/base/special/spencef/package.json new file mode 100644 index 000000000000..60c9ec82520a --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/math/base/special/spencef", + "version": "0.0.0", + "description": "Spence's function (the dilogarithm) for 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", + "special", + "function", + "dilogarithm", + "polylogarithm", + "integral", + "spence", + "spencef", + "number" + ] +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js b/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js new file mode 100644 index 000000000000..f8ccf083e219 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js @@ -0,0 +1,142 @@ +/** +* @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. +*/ + +/* +* This script compiles modules for evaluating polynomial functions. If any polynomial coefficients change, this script should be rerun to update the compiled files. +*/ +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var readFileSync = require( '@stdlib/fs/read-file' ).sync; +var writeFileSync = require( '@stdlib/fs/write-file' ).sync; +var currentYear = require( '@stdlib/time/current-year' ); +var substringBefore = require( '@stdlib/string/substring-before' ); +var substringAfter = require( '@stdlib/string/substring-after' ); +var format = require( '@stdlib/string/format' ); +var licenseHeader = require( '@stdlib/_tools/licenses/header' ); +var compile = require( '@stdlib/math/base/tools/evalpoly-compile' ); +var compileC = require( '@stdlib/math/base/tools/evalpoly-compile-c' ); + + +// VARIABLES // + +// Polynomial coefficients ordered in ascending degree... +var A = [ + 1.00000000000000000126e0, + 3.29771340985225106936e0, + 4.25697156008121755724e0, + 2.71149851196553469920e0, + 8.79691311754530315341e-1, + 1.33847639578309018650e-1, + 7.31589045238094711071e-3, + 4.65128586073990045278e-5 +]; +var B = [ + 9.99999999999999998740e-1, + 3.54771340985225096217e0, + 5.03278880143316990390e0, + 3.63800533345137075418e0, + 1.41172597751831069617e0, + 2.82974860602568089943e-1, + 2.54043763932544379113e-2, + 6.90990488912553276999e-4 +]; + +// Header to add to output files: +var header = licenseHeader( 'Apache-2.0', 'js', { + 'year': currentYear(), + 'copyright': 'The Stdlib Authors' +}); +header += '\n/* This is a generated file. Do not edit directly. */\n'; + + +// FUNCTIONS // + +/** +* Inserts a compiled function into file content. +* +* @private +* @param {string} text - source content +* @param {string} id - function identifier +* @param {string} str - function string +* @returns {string} updated content +*/ +function insert( text, id, str ) { + var before; + var after; + var begin; + var end; + + begin = '// BEGIN: '+id; + end = '// END: '+id; + + before = substringBefore( text, begin ); + after = substringAfter( text, end ); + + return format( '%s// BEGIN: %s\n\n%s\n%s%s', before, id, str, end, after ); +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var fpath; + var copts; + var opts; + var file; + var str; + + opts = { + 'encoding': 'utf8' + }; + + fpath = resolve( __dirname, '..', 'lib', 'polyval_a.js' ); + str = header + compile( A ); + writeFileSync( fpath, str, opts ); + + fpath = resolve( __dirname, '..', 'lib', 'polyval_b.js' ); + str = header + compile( B ); + writeFileSync( fpath, str, opts ); + + copts = { + 'dtype': 'float', + 'name': '' + }; + + fpath = resolve( __dirname, '..', 'src', 'main.c' ); + file = readFileSync( fpath, opts ); + + copts.name = 'polyval_a'; + str = compileC( A, copts ); + file = insert( file, copts.name, str ); + + copts.name = 'polyval_b'; + str = compileC( B, copts ); + file = insert( file, copts.name, str ); + + writeFileSync( fpath, file, opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/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/spencef/src/addon.c b/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c new file mode 100644 index 000000000000..9cdee4858555 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c @@ -0,0 +1,22 @@ +/** +* @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/spencef.h" +#include "stdlib/math/base/napi/unary.h" + +STDLIB_MATH_BASE_NAPI_MODULE_F_F( stdlib_base_spencef ) diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c b/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c new file mode 100644 index 000000000000..53edbae3c5dd --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c @@ -0,0 +1,148 @@ +/** +* @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. +* +* +* ## Notice +* +* The original C code, long comment, copyright, license, and constants are from [Cephes]{@link http://www.netlib.org/cephes}. The implementation follows the original, but has been modified for JavaScript. +* +* ```text +* Copyright 1985, 1987, 1989, 2000 by Stephen L. Moshier +* +* Some software in this archive may be from the book _Methods and Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) or from the Cephes Mathematical Library, a commercial product. In either event, it is copyrighted by the author. What you see here may be used freely but it comes with no support or guarantee. +* +* Stephen L. Moshier +* moshier@na-net.ornl.gov +* ``` +*/ + +#include "stdlib/math/base/special/spencef.h" +#include "stdlib/math/base/assert/is_nanf.h" +#include "stdlib/math/base/special/lnf.h" +#include + +// π^2 / 6 +static const float PI2O6 = 1.644934058189392f; + +/* Begin auto-generated functions. The following functions are auto-generated. Do not edit directly. */ + +// BEGIN: polyval_a + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static float polyval_a( const float x ) { + return 1.0f + (x * (3.297713409852251f + (x * (4.256971560081218f + (x * (2.7114985119655346f + (x * (0.8796913117545303f + (x * (0.13384763957830903f + (x * (0.007315890452380947f + (x * 0.000046512858607399003f))))))))))))); +} + +// END: polyval_a + +// BEGIN: polyval_b + +/** +* Evaluates a polynomial. +* +* ## Notes +* +* - The implementation uses [Horner's rule][horners-method] for efficient computation. +* +* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method +* +* @param x value at which to evaluate the polynomial +* @return evaluated polynomial +*/ +static float polyval_b( const float x ) { + return 1.0f + (x * (3.547713409852251f + (x * (5.03278880143317f + (x * (3.6380053334513707f + (x * (1.4117259775183106f + (x * (0.2829748606025681f + (x * (0.02540437639325444f + (x * 0.0006909904889125533f))))))))))))); +} + +// END: polyval_b + +/* End auto-generated functions. */ + +/** +* Evaluates Spence's function (the dilogarithm) for a single-precision floating-point number. +* +* ## Method +* +* - A rational approximation gives the integral in the interval (0.5, 1.5). +* - Transformation formulas for \\( \tfrac{1}{x} \\) and \\( 1 - x \\) are employed outside the basic expansion range. +* +* ## Notes +* +* - Relative error: +* +* | arithmetic | domain | # trials | peak | rms | +* |:----------:|:-----------:|:--------:|:-------:|:-------:| +* | IEEE | 0,4 | 30000 | 4.4e-7 | 6.3e-8 | +* +* @param x input value +* @return function value +* +* @example +* float y = stdlib_base_spencef( 3.0f ); +* // returns ~-1.437f +*/ +float stdlib_base_spencef( const float x ) { + int32_t flg; + float xc; + float w; + float y; + float z; + + if ( stdlib_base_is_nanf( x ) || x < 0.0 ) { + return 0.0f / 0.0f; // NaN + } + if ( x == 1.0f ) { + return 0.0f; + } + if ( x == 0.0f ) { + return PI2O6; + } + flg = 0; + xc = x; + if ( xc > 2.0f ) { + xc = 1.0f / xc; + flg |= 2; + } + if ( xc > 1.5f ) { + w = ( 1.0f / xc ) - 1.0f; + flg |= 2; + } else if ( xc < 0.5f ) { + w = -xc; + flg |= 1; + } else { + w = xc - 1.0f; + } + y = -w * polyval_a( w ) / polyval_b( w ); + if ( flg & 1 ) { + y = PI2O6 - ( stdlib_base_lnf( xc ) * stdlib_base_lnf( 1.0f - xc ) ) - y; + } + if ( flg & 2 ) { + z = stdlib_base_lnf( xc ); + y = -( 0.5f * z * z ) - y; + } + return y; +} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/large.json b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/large.json new file mode 100644 index 000000000000..e8a809b383be --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/large.json @@ -0,0 +1 @@ +{"x": [0.75, 0.7505007982254028, 0.7510015964508057, 0.7515023946762085, 0.7520031929016113, 0.7525039911270142, 0.753004789352417, 0.7535055875778198, 0.7540063858032227, 0.7545072436332703, 0.7550080418586731, 0.7555088400840759, 0.7560096383094788, 0.7565104365348816, 0.7570112347602844, 0.7575120329856873, 0.7580128312110901, 0.7585136294364929, 0.7590144276618958, 0.7595152258872986, 0.7600160241127014, 0.7605168223381042, 0.7610176205635071, 0.7615184187889099, 0.7620192170143127, 0.7625200152397156, 0.7630208134651184, 0.763521671295166, 0.7640224695205688, 0.7645232677459717, 0.7650240659713745, 0.7655248641967773, 0.7660256624221802, 0.766526460647583, 0.7670272588729858, 0.7675280570983887, 0.7680288553237915, 0.7685296535491943, 0.7690304517745972, 0.76953125, 0.7700320482254028, 0.7705328464508057, 0.7710336446762085, 0.7715344429016113, 0.7720352411270142, 0.7725360989570618, 0.7730368971824646, 0.7735376954078674, 0.7740384936332703, 0.7745392918586731, 0.7750400900840759, 0.7755408883094788, 0.7760416865348816, 0.7765424847602844, 0.7770432829856873, 0.7775440812110901, 0.7780448794364929, 0.7785456776618958, 0.7790464758872986, 0.7795472741127014, 0.7800480723381042, 0.7805488705635071, 0.7810497283935547, 0.7815505266189575, 0.7820513248443604, 0.7825521230697632, 0.783052921295166, 0.7835537195205688, 0.7840545177459717, 0.7845553159713745, 0.7850561141967773, 0.7855569124221802, 0.786057710647583, 0.7865585088729858, 0.7870593070983887, 0.7875601053237915, 0.7880609035491943, 0.7885617017745972, 0.7890625, 0.7895632982254028, 0.7900641560554504, 0.7905649542808533, 0.7910657525062561, 0.7915665507316589, 0.7920673489570618, 0.7925681471824646, 0.7930689454078674, 0.7935697436332703, 0.7940705418586731, 0.7945713400840759, 0.7950721383094788, 0.7955729365348816, 0.7960737347602844, 0.7965745329856873, 0.7970753312110901, 0.7975761294364929, 0.7980769276618958, 0.7985777258872986, 0.7990785837173462, 0.799579381942749, 0.8000801801681519, 0.8005809783935547, 0.8010817766189575, 0.8015825748443604, 0.8020833730697632, 0.802584171295166, 0.8030849695205688, 0.8035857677459717, 0.8040865659713745, 0.8045873641967773, 0.8050881624221802, 0.805588960647583, 0.8060897588729858, 0.8065905570983887, 0.8070913553237915, 0.8075922131538391, 0.8080930113792419, 0.8085938096046448, 0.8090946078300476, 0.8095954060554504, 0.8100962042808533, 0.8105970025062561, 0.8110978007316589, 0.8115985989570618, 0.8120993971824646, 0.8126001954078674, 0.8131009936332703, 0.8136017918586731, 0.8141025900840759, 0.8146033883094788, 0.8151041865348816, 0.8156049847602844, 0.8161057829856873, 0.8166066408157349, 0.8171074390411377, 0.8176082372665405, 0.8181090354919434, 0.8186098337173462, 0.819110631942749, 0.8196114301681519, 0.8201122283935547, 0.8206130266189575, 0.8211138248443604, 0.8216146230697632, 0.822115421295166, 0.8226162195205688, 0.8231170177459717, 0.8236178159713745, 0.8241186141967773, 0.8246194124221802, 0.8251202702522278, 0.8256210684776306, 0.8261218667030334, 0.8266226649284363, 0.8271234631538391, 0.8276242613792419, 0.8281250596046448, 0.8286258578300476, 0.8291266560554504, 0.8296274542808533, 0.8301282525062561, 0.8306290507316589, 0.8311298489570618, 0.8316306471824646, 0.8321314454078674, 0.8326322436332703, 0.8331330418586731, 0.8336338400840759, 0.8341346979141235, 0.8346354961395264, 0.8351362943649292, 0.835637092590332, 0.8361378908157349, 0.8366386890411377, 0.8371394872665405, 0.8376402854919434, 0.8381410837173462, 0.838641881942749, 0.8391426801681519, 0.8396434783935547, 0.8401442766189575, 0.8406450748443604, 0.8411458730697632, 0.841646671295166, 0.8421474695205688, 0.8426482677459717, 0.8431491255760193, 0.8436499238014221, 0.844150722026825, 0.8446515202522278, 0.8451523184776306, 0.8456531167030334, 0.8461539149284363, 0.8466547131538391, 0.8471555113792419, 0.8476563096046448, 0.8481571078300476, 0.8486579060554504, 0.8491587042808533, 0.8496595025062561, 0.8501603007316589, 0.8506610989570618, 0.8511618971824646, 0.8516627550125122, 0.852163553237915, 0.8526643514633179, 0.8531651496887207, 0.8536659479141235, 0.8541667461395264, 0.8546675443649292, 0.855168342590332, 0.8556691408157349, 0.8561699390411377, 0.8566707372665405, 0.8571715354919434, 0.8576723337173462, 0.858173131942749, 0.8586739301681519, 0.8591747283935547, 0.8596755266189575, 0.8601763248443604, 0.860677182674408, 0.8611779808998108, 0.8616787791252136, 0.8621795773506165, 0.8626803755760193, 0.8631811738014221, 0.863681972026825, 0.8641827702522278, 0.8646835684776306, 0.8651843667030334, 0.8656851649284363, 0.8661859631538391, 0.8666867613792419, 0.8671875596046448, 0.8676883578300476, 0.8681891560554504, 0.8686899542808533, 0.8691907525062561, 0.8696916103363037, 0.8701924085617065, 0.8706932067871094, 0.8711940050125122, 0.871694803237915, 0.8721956014633179, 0.8726963996887207, 0.8731971979141235, 0.8736979961395264, 0.8741987943649292, 0.874699592590332, 0.8752003908157349, 0.8757011890411377, 0.8762019872665405, 0.8767027854919434, 0.8772035837173462, 0.877704381942749, 0.8782052397727966, 0.8787060379981995, 0.8792068362236023, 0.8797076344490051, 0.880208432674408, 0.8807092308998108, 0.8812100291252136, 0.8817108273506165, 0.8822116255760193, 0.8827124238014221, 0.883213222026825, 0.8837140202522278, 0.8842148184776306, 0.8847156167030334, 0.8852164149284363, 0.8857172131538391, 0.8862180113792419, 0.8867188096046448, 0.8872196674346924, 0.8877204656600952, 0.888221263885498, 0.8887220621109009, 0.8892228603363037, 0.8897236585617065, 0.8902244567871094, 0.8907252550125122, 0.891226053237915, 0.8917268514633179, 0.8922276496887207, 0.8927284479141235, 0.8932292461395264, 0.8937300443649292, 0.894230842590332, 0.8947316408157349, 0.8952324390411377, 0.8957332372665405, 0.8962340950965881, 0.896734893321991, 0.8972356915473938, 0.8977364897727966, 0.8982372879981995, 0.8987380862236023, 0.8992388844490051, 0.899739682674408, 0.9002404808998108, 0.9007412791252136, 0.9012420773506165, 0.9017428755760193, 0.9022436738014221, 0.902744472026825, 0.9032452702522278, 0.9037460684776306, 0.9042468667030334, 0.904747724533081, 0.9052485227584839, 0.9057493209838867, 0.9062501192092896, 0.9067509174346924, 0.9072517156600952, 0.907752513885498, 0.9082533121109009, 0.9087541103363037, 0.9092549085617065, 0.9097557067871094, 0.9102565050125122, 0.910757303237915, 0.9112581014633179, 0.9117588996887207, 0.9122596979141235, 0.9127604961395264, 0.9132612943649292, 0.9137621521949768, 0.9142629504203796, 0.9147637486457825, 0.9152645468711853, 0.9157653450965881, 0.916266143321991, 0.9167669415473938, 0.9172677397727966, 0.9177685379981995, 0.9182693362236023, 0.9187701344490051, 0.919270932674408, 0.9197717308998108, 0.9202725291252136, 0.9207733273506165, 0.9212741255760193, 0.9217749238014221, 0.922275722026825, 0.9227765798568726, 0.9232773780822754, 0.9237781763076782, 0.924278974533081, 0.9247797727584839, 0.9252805709838867, 0.9257813692092896, 0.9262821674346924, 0.9267829656600952, 0.927283763885498, 0.9277845621109009, 0.9282853603363037, 0.9287861585617065, 0.9292869567871094, 0.9297877550125122, 0.930288553237915, 0.9307893514633179, 0.9312902092933655, 0.9317910075187683, 0.9322918057441711, 0.932792603969574, 0.9332934021949768, 0.9337942004203796, 0.9342949986457825, 0.9347957968711853, 0.9352965950965881, 0.935797393321991, 0.9362981915473938, 0.9367989897727966, 0.9372997879981995, 0.9378005862236023, 0.9383013844490051, 0.938802182674408, 0.9393029808998108, 0.9398037791252136, 0.9403046369552612, 0.9408054351806641, 0.9413062334060669, 0.9418070316314697, 0.9423078298568726, 0.9428086280822754, 0.9433094263076782, 0.943810224533081, 0.9443110227584839, 0.9448118209838867, 0.9453126192092896, 0.9458134174346924, 0.9463142156600952, 0.946815013885498, 0.9473158121109009, 0.9478166103363037, 0.9483174085617065, 0.9488182067871094, 0.949319064617157, 0.9498198628425598, 0.9503206610679626, 0.9508214592933655, 0.9513222575187683, 0.9518230557441711, 0.952323853969574, 0.9528246521949768, 0.9533254504203796, 0.9538262486457825, 0.9543270468711853, 0.9548278450965881, 0.955328643321991, 0.9558294415473938, 0.9563302397727966, 0.9568310379981995, 0.9573318362236023, 0.9578326940536499, 0.9583334922790527, 0.9588342905044556, 0.9593350887298584, 0.9598358869552612, 0.9603366851806641, 0.9608374834060669, 0.9613382816314697, 0.9618390798568726, 0.9623398780822754, 0.9628406763076782, 0.963341474533081, 0.9638422727584839, 0.9643430709838867, 0.9648438692092896, 0.9653446674346924, 0.9658454656600952, 0.966346263885498, 0.9668471217155457, 0.9673479199409485, 0.9678487181663513, 0.9683495163917542, 0.968850314617157, 0.9693511128425598, 0.9698519110679626, 0.9703527092933655, 0.9708535075187683, 0.9713543057441711, 0.971855103969574, 0.9723559021949768, 0.9728567004203796, 0.9733574986457825, 0.9738582968711853, 0.9743590950965881, 0.974859893321991, 0.9753607511520386, 0.9758615493774414, 0.9763623476028442, 0.9768631458282471, 0.9773639440536499, 0.9778647422790527, 0.9783655405044556, 0.9788663387298584, 0.9793671369552612, 0.9798679351806641, 0.9803687334060669, 0.9808695316314697, 0.9813703298568726, 0.9818711280822754, 0.9823719263076782, 0.982872724533081, 0.9833735227584839, 0.9838743209838867, 0.9843751788139343, 0.9848759770393372, 0.98537677526474, 0.9858775734901428, 0.9863783717155457, 0.9868791699409485, 0.9873799681663513, 0.9878807663917542, 0.988381564617157, 0.9888823628425598, 0.9893831610679626, 0.9898839592933655, 0.9903847575187683, 0.9908855557441711, 0.991386353969574, 0.9918871521949768, 0.9923879504203796, 0.9928887486457825, 0.9933896064758301, 0.9938904047012329, 0.9943912029266357, 0.9948920011520386, 0.9953927993774414, 0.9958935976028442, 0.9963943958282471, 0.9968951940536499, 0.9973959922790527, 0.9978967905044556, 0.9983975887298584, 0.9988983869552612, 0.9993991851806641, 0.9998999834060669], "expected": [0.26765263080596924, 0.2670764625072479, 0.26650044322013855, 0.2659246027469635, 0.26534897089004517, 0.26477351784706116, 0.2641982436180115, 0.2636231482028961, 0.2630482316017151, 0.2624734342098236, 0.26189887523651123, 0.2613244950771332, 0.26075032353401184, 0.26017633080482483, 0.25960248708724976, 0.2590288519859314, 0.25845539569854736, 0.25788211822509766, 0.2573090195655823, 0.25673606991767883, 0.2561633586883545, 0.2555907964706421, 0.255018413066864, 0.25444620847702026, 0.25387418270111084, 0.25330233573913574, 0.25273066759109497, 0.25215911865234375, 0.25158780813217163, 0.2510167062282562, 0.25044575333595276, 0.24987497925758362, 0.2493043839931488, 0.2487339824438095, 0.24816374480724335, 0.2475936859846115, 0.247023805975914, 0.24645410478115082, 0.24588458240032196, 0.24531523883342743, 0.24474607408046722, 0.24417708814144135, 0.2436082661151886, 0.24303962290287018, 0.24247117340564728, 0.24190281331539154, 0.2413347065448761, 0.24076677858829498, 0.240199014544487, 0.23963142931461334, 0.2390640377998352, 0.238496795296669, 0.23792974650859833, 0.23736286163330078, 0.23679617047309875, 0.23622962832450867, 0.2356632798910141, 0.23509709537029266, 0.23453108966350555, 0.23396526277065277, 0.23339961469173431, 0.232834130525589, 0.23226875066757202, 0.23170360922813416, 0.23113864660263062, 0.2305738627910614, 0.23000924289226532, 0.22944480180740356, 0.22888053953647614, 0.22831644117832184, 0.22775252163410187, 0.22718876600265503, 0.22662518918514252, 0.22606179118156433, 0.22549855709075928, 0.22493548691272736, 0.22437261044979095, 0.2238098829984665, 0.22324733436107635, 0.22268496453762054, 0.2221226990222931, 0.22156065702438354, 0.22099880874156952, 0.22043710947036743, 0.21987558901309967, 0.21931424736976624, 0.21875306963920593, 0.21819205582141876, 0.21763122081756592, 0.2170705497264862, 0.21651005744934082, 0.21594972908496857, 0.21538956463336945, 0.21482957899570465, 0.214269757270813, 0.21371009945869446, 0.21315062046051025, 0.21259130537509918, 0.21203209459781647, 0.21147312223911285, 0.21091431379318237, 0.21035568416118622, 0.209797203540802, 0.2092389017343521, 0.20868077874183655, 0.20812280476093292, 0.20756500959396362, 0.20700737833976746, 0.20644991099834442, 0.2058926224708557, 0.20533548295497894, 0.2047785222530365, 0.2042217254638672, 0.2036651074886322, 0.20310863852500916, 0.20255227386951447, 0.20199614763259888, 0.20144018530845642, 0.2008843868970871, 0.2003287523984909, 0.19977329671382904, 0.1992179900407791, 0.1986628621816635, 0.19810789823532104, 0.19755308330059052, 0.1969984471797943, 0.19644397497177124, 0.1958896666765213, 0.1953355222940445, 0.19478154182434082, 0.19422772526741028, 0.19367407262325287, 0.19312059879302979, 0.19256719946861267, 0.19201403856277466, 0.19146105647087097, 0.19090822339057922, 0.1903555542230606, 0.18980304896831512, 0.18925070762634277, 0.18869853019714355, 0.18814651668071747, 0.18759466707706451, 0.1870429813861847, 0.1864914447069168, 0.18594008684158325, 0.18538887798786163, 0.18483784794807434, 0.184286966919899, 0.18373624980449677, 0.1831856369972229, 0.18263523280620575, 0.18208500742912292, 0.18153494596481323, 0.18098503351211548, 0.18043528497219086, 0.17988570034503937, 0.179336279630661, 0.1787870079278946, 0.1782379150390625, 0.17768897116184235, 0.17714019119739532, 0.17659156024456024, 0.17604310810565948, 0.17549480497837067, 0.17494666576385498, 0.17439867556095123, 0.1738508641719818, 0.17330312728881836, 0.172755628824234, 0.1722082793712616, 0.17166109383106232, 0.17111407220363617, 0.17056721448898315, 0.17002050578594208, 0.16947394609451294, 0.16892756521701813, 0.16838133335113525, 0.16783525049686432, 0.16728933155536652, 0.16674357652664185, 0.1661979854106903, 0.1656525433063507, 0.16510725021362305, 0.16456212103366852, 0.16401715576648712, 0.1634722799062729, 0.16292762756347656, 0.16238312423229218, 0.16183878481388092, 0.1612946093082428, 0.1607505828142166, 0.16020670533180237, 0.15966299176216125, 0.15911942720413208, 0.15857602655887604, 0.15803278982639313, 0.15748970210552216, 0.15694676339626312, 0.15640398859977722, 0.15586136281490326, 0.15531890094280243, 0.15477658808231354, 0.1542343646287918, 0.153692364692688, 0.1531505137681961, 0.15260882675647736, 0.15206728875637054, 0.15152589976787567, 0.15098467469215393, 0.15044359862804413, 0.14990268647670746, 0.14936192333698273, 0.14882130920886993, 0.14828085899353027, 0.14774054288864136, 0.14720040559768677, 0.14666040241718292, 0.1461205631494522, 0.14558087289333344, 0.1450413316488266, 0.14450189471244812, 0.14396266639232635, 0.14342358708381653, 0.14288465678691864, 0.14234589040279388, 0.14180727303028107, 0.1412688046693802, 0.14073048532009125, 0.14019232988357544, 0.13965432345867157, 0.13911645114421844, 0.13857875764369965, 0.1380411982536316, 0.13750378787517548, 0.1369665414094925, 0.13642944395542145, 0.13589249551296234, 0.13535569608211517, 0.13481898605823517, 0.13428248465061188, 0.13374614715576172, 0.1332099437713623, 0.13267390429973602, 0.13213801383972168, 0.13160227239131927, 0.1310666799545288, 0.13053123652935028, 0.1299959421157837, 0.12946079671382904, 0.12892580032348633, 0.12839096784591675, 0.1278562694787979, 0.12732172012329102, 0.12678731977939606, 0.12625308334827423, 0.12571892142295837, 0.12518496811389923, 0.12465117126703262, 0.12411752343177795, 0.12358401715755463, 0.12305066734552383, 0.12251745909452438, 0.12198440730571747, 0.1214514970779419, 0.12091873586177826, 0.12038612365722656, 0.1198536604642868, 0.11932134628295898, 0.1187891736626625, 0.11825715005397797, 0.11772527545690536, 0.1171935498714447, 0.11666197329759598, 0.11613047868013382, 0.11559919267892838, 0.11506804823875427, 0.1145370602607727, 0.11400621384382248, 0.11347551643848419, 0.11294496059417725, 0.11241455376148224, 0.11188429594039917, 0.11135417968034744, 0.11082421243190765, 0.1102943941950798, 0.1097647175192833, 0.10923518985509872, 0.1087058037519455, 0.10817655920982361, 0.10764747112989426, 0.10711851716041565, 0.1065896525979042, 0.10606099665164948, 0.10553248226642609, 0.10500410944223404, 0.10447588562965393, 0.10394781082868576, 0.10341987013816833, 0.10289208590984344, 0.1023644357919693, 0.10183693468570709, 0.10130957514047623, 0.1007823646068573, 0.10025528818368912, 0.09972836077213287, 0.09920158237218857, 0.09867493808269501, 0.09814844280481339, 0.09762202948331833, 0.09709581732749939, 0.09656975418329239, 0.09604383260011673, 0.09551805257797241, 0.09499241411685944, 0.0944669172167778, 0.0939415693283081, 0.09341635555028915, 0.09289129078388214, 0.09236636012792587, 0.09184157848358154, 0.09131693840026855, 0.09079243987798691, 0.0902680829167366, 0.08974386751651764, 0.08921979367733002, 0.08869586139917374, 0.08817201107740402, 0.08764836192131042, 0.08712485432624817, 0.08660148829221725, 0.08607826381921768, 0.08555517345666885, 0.08503223210573196, 0.08450942486524582, 0.08398676663637161, 0.08346424251794815, 0.08294185996055603, 0.08241961896419525, 0.08189751952886581, 0.08137556165456772, 0.08085373789072037, 0.08033205568790436, 0.07981051504611969, 0.07928911596536636, 0.078767791390419, 0.07824666798114777, 0.07772568613290787, 0.07720484584569931, 0.0766841396689415, 0.07616357505321503, 0.0756431519985199, 0.07512286305427551, 0.07460271567106247, 0.07408270239830017, 0.07356283068656921, 0.0730431005358696, 0.07252350449562073, 0.0720040500164032, 0.07148473709821701, 0.07096555829048157, 0.07044651359319687, 0.06992755085229874, 0.06940878182649612, 0.06889015436172485, 0.06837166845798492, 0.06785331666469574, 0.0673350989818573, 0.0668170228600502, 0.06629908084869385, 0.06578128039836884, 0.06526361405849457, 0.06474608182907104, 0.06422869116067886, 0.06371143460273743, 0.06319431960582733, 0.06267733126878738, 0.06216048821806908, 0.061643779277801514, 0.061127208173274994, 0.060610707849264145, 0.06009440869092941, 0.059578243643045425, 0.05906221270561218, 0.05854632332921028, 0.058030564337968826, 0.057514943182468414, 0.05699945613741875, 0.05648410692811012, 0.05596889182925224, 0.05545381084084511, 0.05493886396288872, 0.05442405492067337, 0.05390937998890877, 0.05339483916759491, 0.052880436182022095, 0.052366163581609726, 0.0518520288169384, 0.051337964832782745, 0.05082409828901291, 0.05031036585569382, 0.04979676753282547, 0.04928329959511757, 0.04876996949315071, 0.0482567735016346, 0.04774371162056923, 0.04723078012466431, 0.04671798646450043, 0.046205323189496994, 0.045692794024944305, 0.04518039897084236, 0.04466813802719116, 0.04415601119399071, 0.0436440147459507, 0.043132152408361435, 0.04262036085128784, 0.04210876300930977, 0.04159729927778244, 0.04108596593141556, 0.04057476669549942, 0.04006370157003403, 0.03955276682972908, 0.03904196619987488, 0.03853129595518112, 0.03802075609564781, 0.03751035034656525, 0.03700007498264313, 0.03648993372917175, 0.035979922860860825, 0.03547004610300064, 0.034960296005010605, 0.034450680017471313, 0.03394119814038277, 0.03343178331851959, 0.03292255848646164, 0.03241346776485443, 0.03190450742840767, 0.03139568120241165, 0.030886981636285782, 0.03037841245532036, 0.02986997552216053, 0.029361668974161148, 0.028853492811322212, 0.028345447033643723, 0.02783753164112568, 0.02732974663376808, 0.02682209014892578, 0.026314564049243927, 0.025807170197367668, 0.025299903005361557, 0.024792706593871117, 0.024285702034831047, 0.023778824135661125, 0.02327207662165165, 0.02276545949280262, 0.022258970886468887, 0.02175261080265045, 0.021246381103992462, 0.02074027992784977, 0.020234307274222374, 0.019728463143110275, 0.019222749397158623, 0.018717162311077118, 0.01821170561015606, 0.01770637556910515, 0.017201175913214684, 0.016696102917194366, 0.016191158443689346, 0.015686282888054848, 0.015181594528257847, 0.014677034690976143, 0.014172602444887161, 0.013668298721313477, 0.01316412165760994, 0.0126600731164217, 0.012156152166426182, 0.011652357876300812, 0.011148691177368164, 0.010645152069628239, 0.010141739621758461, 0.009638454765081406, 0.009135297499597073, 0.008632265962660313, 0.008129362016916275, 0.007626584731042385, 0.007123934105038643, 0.006621350068598986, 0.0061189522966742516, 0.005616681184619665, 0.0051145367324352264, 0.004612518008798361, 0.004110625945031643, 0.0036088593769818544, 0.00310721923597157, 0.0026057048235088587, 0.002104316372424364, 0.0016030536498874426, 0.0011019165394827724, 0.0006009050994180143, 0.00010001909686252475]} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/medium.json b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/medium.json new file mode 100644 index 000000000000..5ed54610061c --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/medium.json @@ -0,0 +1 @@ +{"x": [0.25, 0.2510020136833191, 0.2520039975643158, 0.2530060112476349, 0.254008024930954, 0.2550100088119507, 0.2560120224952698, 0.25701403617858887, 0.25801602005958557, 0.25901803374290466, 0.26002004742622375, 0.26102203130722046, 0.26202404499053955, 0.26302605867385864, 0.26402804255485535, 0.26503005623817444, 0.26603206992149353, 0.26703405380249023, 0.2680360674858093, 0.2690380811691284, 0.2700400948524475, 0.2710420787334442, 0.2720440924167633, 0.2730461061000824, 0.2740480899810791, 0.2750501036643982, 0.2760521173477173, 0.277054101228714, 0.2780561149120331, 0.2790581285953522, 0.2800601124763489, 0.28106212615966797, 0.28206413984298706, 0.28306612372398376, 0.28406813740730286, 0.28507015109062195, 0.28607213497161865, 0.28707414865493774, 0.28807616233825684, 0.28907814621925354, 0.29008015990257263, 0.2910821735858917, 0.2920841574668884, 0.2930861711502075, 0.2940881848335266, 0.2950901687145233, 0.2960921823978424, 0.2970941960811615, 0.2980961799621582, 0.2990981936454773, 0.3001002073287964, 0.3011021912097931, 0.3021042048931122, 0.3031062185764313, 0.304108202457428, 0.30511021614074707, 0.30611222982406616, 0.30711421370506287, 0.30811622738838196, 0.30911824107170105, 0.31012025475502014, 0.31112223863601685, 0.31212425231933594, 0.31312626600265503, 0.31412824988365173, 0.3151302635669708, 0.3161322772502899, 0.3171342611312866, 0.3181362748146057, 0.3191382884979248, 0.3201402723789215, 0.3211422860622406, 0.3221442997455597, 0.3231462836265564, 0.3241482973098755, 0.3251503109931946, 0.3261522948741913, 0.3271543085575104, 0.32815632224082947, 0.32915830612182617, 0.33016031980514526, 0.33116233348846436, 0.33216431736946106, 0.33316633105278015, 0.33416834473609924, 0.33517032861709595, 0.33617234230041504, 0.33717435598373413, 0.33817633986473083, 0.3391783535480499, 0.340180367231369, 0.3411823511123657, 0.3421843647956848, 0.3431863784790039, 0.3441883623600006, 0.3451903760433197, 0.3461923897266388, 0.3471944034099579, 0.3481963872909546, 0.3491984009742737, 0.3502004146575928, 0.3512023985385895, 0.35220441222190857, 0.35320642590522766, 0.35420840978622437, 0.35521042346954346, 0.35621243715286255, 0.35721442103385925, 0.35821643471717834, 0.35921844840049744, 0.36022043228149414, 0.36122244596481323, 0.3622244596481323, 0.36322644352912903, 0.3642284572124481, 0.3652304708957672, 0.3662324547767639, 0.367234468460083, 0.3682364821434021, 0.3692384660243988, 0.3702404797077179, 0.371242493391037, 0.3722444772720337, 0.3732464909553528, 0.3742485046386719, 0.3752504885196686, 0.37625250220298767, 0.37725451588630676, 0.37825649976730347, 0.37925851345062256, 0.38026052713394165, 0.38126251101493835, 0.38226452469825745, 0.38326653838157654, 0.38426852226257324, 0.38527053594589233, 0.3862725496292114, 0.3872745633125305, 0.3882765471935272, 0.3892785608768463, 0.3902805745601654, 0.3912825584411621, 0.3922845721244812, 0.3932865858078003, 0.394288569688797, 0.3952905833721161, 0.3962925970554352, 0.3972945809364319, 0.398296594619751, 0.39929860830307007, 0.4003005921840668, 0.40130260586738586, 0.40230461955070496, 0.40330660343170166, 0.40430861711502075, 0.40531063079833984, 0.40631261467933655, 0.40731462836265564, 0.40831664204597473, 0.40931862592697144, 0.4103206396102905, 0.4113226532936096, 0.4123246371746063, 0.4133266508579254, 0.4143286645412445, 0.4153306484222412, 0.4163326621055603, 0.4173346757888794, 0.4183366596698761, 0.4193386733531952, 0.4203406870365143, 0.421342670917511, 0.4223446846008301, 0.42334669828414917, 0.42434871196746826, 0.42535069584846497, 0.42635270953178406, 0.42735472321510315, 0.42835670709609985, 0.42935872077941895, 0.43036073446273804, 0.43136271834373474, 0.43236473202705383, 0.4333667457103729, 0.43436872959136963, 0.4353707432746887, 0.4363727569580078, 0.4373747408390045, 0.4383767545223236, 0.4393787682056427, 0.4403807520866394, 0.4413827657699585, 0.4423847794532776, 0.4433867633342743, 0.4443887770175934, 0.4453907907009125, 0.4463927745819092, 0.44739478826522827, 0.44839680194854736, 0.44939878582954407, 0.45040079951286316, 0.45140281319618225, 0.45240479707717896, 0.45340681076049805, 0.45440882444381714, 0.45541080832481384, 0.45641282200813293, 0.457414835691452, 0.45841681957244873, 0.4594188332557678, 0.4604208469390869, 0.4614228308200836, 0.4624248445034027, 0.4634268581867218, 0.4644288718700409, 0.4654308557510376, 0.4664328694343567, 0.4674348831176758, 0.4684368669986725, 0.4694388806819916, 0.47044089436531067, 0.4714428782463074, 0.47244489192962646, 0.47344690561294556, 0.47444888949394226, 0.47545090317726135, 0.47645291686058044, 0.47745490074157715, 0.47845691442489624, 0.47945892810821533, 0.48046091198921204, 0.48146292567253113, 0.4824649393558502, 0.4834669232368469, 0.484468936920166, 0.4854709506034851, 0.4864729344844818, 0.4874749481678009, 0.48847696185112, 0.4894789457321167, 0.4904809594154358, 0.4914829730987549, 0.4924849569797516, 0.4934869706630707, 0.49448898434638977, 0.4954909682273865, 0.49649298191070557, 0.49749499559402466, 0.49849697947502136, 0.49949899315834045, 0.5005009770393372, 0.5015029907226562, 0.5025050044059753, 0.5035070180892944, 0.5045090317726135, 0.5055110454559326, 0.5065129995346069, 0.507515013217926, 0.5085170269012451, 0.5095190405845642, 0.5105210542678833, 0.5115230679512024, 0.5125250220298767, 0.5135270357131958, 0.5145290493965149, 0.515531063079834, 0.5165330767631531, 0.5175350904464722, 0.5185370445251465, 0.5195390582084656, 0.5205410718917847, 0.5215430855751038, 0.5225450992584229, 0.5235471129417419, 0.524549126625061, 0.5255510807037354, 0.5265530943870544, 0.5275551080703735, 0.5285571217536926, 0.5295591354370117, 0.5305611491203308, 0.5315631031990051, 0.5325651168823242, 0.5335671305656433, 0.5345691442489624, 0.5355711579322815, 0.5365731716156006, 0.5375751256942749, 0.538577139377594, 0.5395791530609131, 0.5405811667442322, 0.5415831804275513, 0.5425851941108704, 0.5435871481895447, 0.5445891618728638, 0.5455911755561829, 0.546593189239502, 0.547595202922821, 0.5485972166061401, 0.5495991706848145, 0.5506011843681335, 0.5516031980514526, 0.5526052117347717, 0.5536072254180908, 0.5546092391014099, 0.5556111931800842, 0.5566132068634033, 0.5576152205467224, 0.5586172342300415, 0.5596192479133606, 0.5606212615966797, 0.5616232752799988, 0.5626252293586731, 0.5636272430419922, 0.5646292567253113, 0.5656312704086304, 0.5666332840919495, 0.5676352977752686, 0.5686372518539429, 0.569639265537262, 0.570641279220581, 0.5716432929039001, 0.5726453065872192, 0.5736473202705383, 0.5746492743492126, 0.5756512880325317, 0.5766533017158508, 0.5776553153991699, 0.578657329082489, 0.5796593427658081, 0.5806612968444824, 0.5816633105278015, 0.5826653242111206, 0.5836673378944397, 0.5846693515777588, 0.5856713652610779, 0.5866733193397522, 0.5876753330230713, 0.5886773467063904, 0.5896793603897095, 0.5906813740730286, 0.5916833877563477, 0.592685341835022, 0.5936873555183411, 0.5946893692016602, 0.5956913828849792, 0.5966933965682983, 0.5976954102516174, 0.5986974239349365, 0.5996993780136108, 0.6007013916969299, 0.601703405380249, 0.6027054190635681, 0.6037074327468872, 0.6047094464302063, 0.6057114005088806, 0.6067134141921997, 0.6077154278755188, 0.6087174415588379, 0.609719455242157, 0.6107214689254761, 0.6117234230041504, 0.6127254366874695, 0.6137274503707886, 0.6147294640541077, 0.6157314777374268, 0.6167334914207458, 0.6177354454994202, 0.6187374591827393, 0.6197394728660583, 0.6207414865493774, 0.6217435002326965, 0.6227455139160156, 0.6237474679946899, 0.624749481678009, 0.6257514953613281, 0.6267535090446472, 0.6277555227279663, 0.6287575364112854, 0.6297594904899597, 0.6307615041732788, 0.6317635178565979, 0.632765531539917, 0.6337675452232361, 0.6347695589065552, 0.6357715725898743, 0.6367735266685486, 0.6377755403518677, 0.6387775540351868, 0.6397795677185059, 0.640781581401825, 0.641783595085144, 0.6427855491638184, 0.6437875628471375, 0.6447895765304565, 0.6457915902137756, 0.6467936038970947, 0.6477956175804138, 0.6487975716590881, 0.6497995853424072, 0.6508015990257263, 0.6518036127090454, 0.6528056263923645, 0.6538076400756836, 0.6548095941543579, 0.655811607837677, 0.6568136215209961, 0.6578156352043152, 0.6588176488876343, 0.6598196625709534, 0.6608216166496277, 0.6618236303329468, 0.6628256440162659, 0.663827657699585, 0.664829671382904, 0.6658316850662231, 0.6668336391448975, 0.6678356528282166, 0.6688376665115356, 0.6698396801948547, 0.6708416938781738, 0.6718437075614929, 0.6728456616401672, 0.6738476753234863, 0.6748496890068054, 0.6758517026901245, 0.6768537163734436, 0.6778557300567627, 0.6788577437400818, 0.6798596978187561, 0.6808617115020752, 0.6818637251853943, 0.6828657388687134, 0.6838677525520325, 0.6848697662353516, 0.6858717203140259, 0.686873733997345, 0.6878757476806641, 0.6888777613639832, 0.6898797750473022, 0.6908817887306213, 0.6918837428092957, 0.6928857564926147, 0.6938877701759338, 0.6948897838592529, 0.695891797542572, 0.6968938112258911, 0.6978957653045654, 0.6988977789878845, 0.6998997926712036, 0.7009018063545227, 0.7019038200378418, 0.7029058337211609, 0.7039077877998352, 0.7049098014831543, 0.7059118151664734, 0.7069138288497925, 0.7079158425331116, 0.7089178562164307, 0.709919810295105, 0.7109218239784241, 0.7119238376617432, 0.7129258513450623, 0.7139278650283813, 0.7149298787117004, 0.7159318923950195, 0.7169338464736938, 0.7179358601570129, 0.718937873840332, 0.7199398875236511, 0.7209419012069702, 0.7219439148902893, 0.7229458689689636, 0.7239478826522827, 0.7249498963356018, 0.7259519100189209, 0.72695392370224, 0.7279559373855591, 0.7289578914642334, 0.7299599051475525, 0.7309619188308716, 0.7319639325141907, 0.7329659461975098, 0.7339679598808289, 0.7349699139595032, 0.7359719276428223, 0.7369739413261414, 0.7379759550094604, 0.7389779686927795, 0.7399799823760986, 0.740981936454773, 0.741983950138092, 0.7429859638214111, 0.7439879775047302, 0.7449899911880493, 0.7459920048713684, 0.7469939589500427, 0.7479959726333618, 0.7489979863166809, 0.75], "expected": [0.9784693717956543, 0.9766187071800232, 0.9747709631919861, 0.9729260206222534, 0.9710838794708252, 0.969244658946991, 0.9674081802368164, 0.9655745029449463, 0.9637436270713806, 0.9619155526161194, 0.960090160369873, 0.9582676291465759, 0.9564477801322937, 0.9546306133270264, 0.9528162479400635, 0.9510045051574707, 0.9491954445838928, 0.9473891258239746, 0.9455853700637817, 0.9437842965126038, 0.9419859051704407, 0.9401901364326477, 0.9383969306945801, 0.9366063475608826, 0.9348184466362, 0.9330329895019531, 0.9312501549720764, 0.9294699430465698, 0.927692174911499, 0.9259170293807983, 0.9241443872451782, 0.9223741888999939, 0.9206065535545349, 0.9188414216041565, 0.9170787334442139, 0.9153185486793518, 0.9135608673095703, 0.9118055701255798, 0.9100527167320251, 0.9083023071289062, 0.9065542817115784, 0.9048087000846863, 0.90306556224823, 0.9013247489929199, 0.8995863199234009, 0.8978503346443176, 0.8961166143417358, 0.8943852782249451, 0.8926563262939453, 0.890929639339447, 0.889205276966095, 0.8874832987785339, 0.8857635855674744, 0.8840461373329163, 0.8823310136795044, 0.880618155002594, 0.8789075016975403, 0.8771992325782776, 0.8754931092262268, 0.8737892508506775, 0.8720876574516296, 0.8703882694244385, 0.868691086769104, 0.8669961094856262, 0.8653033375740051, 0.8636127710342407, 0.8619243502616882, 0.8602381348609924, 0.8585540652275085, 0.8568721413612366, 0.8551923632621765, 0.8535147309303284, 0.8518392443656921, 0.8501659035682678, 0.8484945893287659, 0.8468254208564758, 0.8451583981513977, 0.8434934020042419, 0.8418305516242981, 0.8401697278022766, 0.8385109901428223, 0.8368543386459351, 0.8351997137069702, 0.8335471153259277, 0.8318965435028076, 0.8302480578422546, 0.828601598739624, 0.826957106590271, 0.8253146409988403, 0.8236741423606873, 0.8220356702804565, 0.8203992247581482, 0.8187646865844727, 0.8171321749687195, 0.8155016303062439, 0.8138729929924011, 0.8122463226318359, 0.8106215596199036, 0.8089988231658936, 0.8073779940605164, 0.8057590126991272, 0.8041420578956604, 0.8025269508361816, 0.8009137511253357, 0.7993024587631226, 0.7976930737495422, 0.79608553647995, 0.7944799065589905, 0.792876124382019, 0.7912741899490356, 0.7896741628646851, 0.7880759835243225, 0.7864795923233032, 0.7848851084709167, 0.7832924127578735, 0.7817015647888184, 0.7801125645637512, 0.7785253524780273, 0.7769399285316467, 0.7753563523292542, 0.7737745046615601, 0.772194504737854, 0.7706162929534912, 0.7690398097038269, 0.7674651145935059, 0.7658922672271729, 0.7643210887908936, 0.7627516984939575, 0.76118403673172, 0.7596181631088257, 0.7580539584159851, 0.7564915418624878, 0.754930853843689, 0.7533718347549438, 0.751814603805542, 0.7502590417861938, 0.7487051486968994, 0.7471529841423035, 0.7456026077270508, 0.7440537810325623, 0.7425066828727722, 0.7409613132476807, 0.739417552947998, 0.7378755211830139, 0.7363350987434387, 0.7347963452339172, 0.7332592606544495, 0.7317238450050354, 0.7301900386810303, 0.7286578416824341, 0.7271273136138916, 0.7255983948707581, 0.7240710854530334, 0.7225454449653625, 0.7210213541984558, 0.7194989323616028, 0.7179780602455139, 0.716458797454834, 0.714941143989563, 0.7134250998497009, 0.711910605430603, 0.7103976607322693, 0.7088863253593445, 0.7073765397071838, 0.7058683037757874, 0.7043616771697998, 0.7028565406799316, 0.7013530135154724, 0.6998510360717773, 0.6983505487442017, 0.6968516111373901, 0.6953542232513428, 0.6938583254814148, 0.692363977432251, 0.6908711194992065, 0.6893798112869263, 0.6878899931907654, 0.6864016652107239, 0.6849148869514465, 0.6834295392036438, 0.6819456815719604, 0.6804633736610413, 0.6789824962615967, 0.6775031089782715, 0.6760252714157104, 0.6745488047599792, 0.6730738282203674, 0.671600341796875, 0.6701282858848572, 0.668657660484314, 0.6671885251998901, 0.6657208204269409, 0.6642545461654663, 0.6627897620201111, 0.6613263487815857, 0.6598643660545349, 0.6584038734436035, 0.656944751739502, 0.6554870009422302, 0.6540307402610779, 0.6525758504867554, 0.6511223316192627, 0.6496703028678894, 0.648219645023346, 0.6467702984809875, 0.6453224420547485, 0.6438758969306946, 0.6424307823181152, 0.6409870386123657, 0.639544665813446, 0.6381036639213562, 0.6366640329360962, 0.6352257132530212, 0.6337888240814209, 0.6323532462120056, 0.6309190392494202, 0.6294861435890198, 0.6280546188354492, 0.6266244649887085, 0.6251956224441528, 0.6237680912017822, 0.6223419904708862, 0.6209170818328857, 0.6194935441017151, 0.6180713772773743, 0.6166504621505737, 0.615230917930603, 0.6138126850128174, 0.612395703792572, 0.6109800338745117, 0.6095656752586365, 0.6081526279449463, 0.6067408323287964, 0.6053303480148315, 0.6039211750030518, 0.6025131940841675, 0.601106584072113, 0.5997012257575989, 0.598297119140625, 0.5968943238258362, 0.5954927802085876, 0.5940924882888794, 0.5926934480667114, 0.5912956595420837, 0.5898991227149963, 0.588503897190094, 0.5871098637580872, 0.5857170820236206, 0.5843255519866943, 0.5829352140426636, 0.5815461874008179, 0.5801583528518677, 0.578771710395813, 0.5773863196372986, 0.5760021209716797, 0.5746191740036011, 0.5732374787330627, 0.5718569755554199, 0.5704776048660278, 0.569099485874176, 0.5677225589752197, 0.5663468837738037, 0.564972460269928, 0.5635991096496582, 0.5622270107269287, 0.56085604429245, 0.5594862699508667, 0.558117687702179, 0.5567504167556763, 0.5553841590881348, 0.5540191531181335, 0.5526552796363831, 0.5512925386428833, 0.549930989742279, 0.5485706329345703, 0.5472115278244019, 0.5458534359931946, 0.5444965362548828, 0.5431407690048218, 0.5417861938476562, 0.5404327511787415, 0.5390805006027222, 0.5377293229103088, 0.5363792777061462, 0.5350304245948792, 0.533682644367218, 0.5323359966278076, 0.5309905409812927, 0.5296461582183838, 0.5283029079437256, 0.5269607901573181, 0.5256197452545166, 0.5242798328399658, 0.5229411125183105, 0.5216034054756165, 0.5202668309211731, 0.5189313888549805, 0.517596960067749, 0.5162637233734131, 0.5149315595626831, 0.5136004686355591, 0.5122705101966858, 0.5109415650367737, 0.5096137523651123, 0.5082870125770569, 0.5069614052772522, 0.5056368708610535, 0.5043133497238159, 0.5029909014701843, 0.5016695261001587, 0.500349223613739, 0.4990300238132477, 0.4977119266986847, 0.4963948130607605, 0.49507877230644226, 0.49376380443573, 0.4924498498439789, 0.49113696813583374, 0.48982521891593933, 0.48851442337036133, 0.4872047007083893, 0.4858959913253784, 0.4845883548259735, 0.4832817316055298, 0.4819762110710144, 0.4806716740131378, 0.4793681502342224, 0.4780656695365906, 0.4767642021179199, 0.47546374797821045, 0.4741644263267517, 0.472866028547287, 0.47156864404678345, 0.4702722728252411, 0.4689769148826599, 0.4676825702190399, 0.46638932824134827, 0.46509698033332825, 0.4638056755065918, 0.46251535415649414, 0.4612260162830353, 0.4599376916885376, 0.4586504399776459, 0.45736411213874817, 0.45607876777648926, 0.45479443669319153, 0.4535110592842102, 0.4522286653518677, 0.45094728469848633, 0.44966691732406616, 0.4483875036239624, 0.44710901379585266, 0.4458315372467041, 0.44455501437187195, 0.4432794749736786, 0.4420049786567688, 0.44073134660720825, 0.4394586980342865, 0.43818703293800354, 0.4369162917137146, 0.43564653396606445, 0.4343777894973755, 0.43310993909835815, 0.4318430423736572, 0.4305770695209503, 0.4293120801448822, 0.4280480146408081, 0.4267849624156952, 0.4255227744579315, 0.42426154017448425, 0.4230012595653534, 0.42174190282821655, 0.42048346996307373, 0.4192260503768921, 0.4179694950580597, 0.4167138338088989, 0.41545912623405457, 0.4142053425312042, 0.4129524827003479, 0.41170063614845276, 0.4104496240615845, 0.4091995060443878, 0.4079503118991852, 0.40670204162597656, 0.40545469522476196, 0.404208242893219, 0.4029627740383148, 0.4017181098461151, 0.4004743993282318, 0.39923155307769775, 0.3979896306991577, 0.3967486023902893, 0.3955085277557373, 0.39426928758621216, 0.39303094148635864, 0.39179348945617676, 0.3905569314956665, 0.3893212378025055, 0.3880865275859833, 0.3868526220321655, 0.3856196105480194, 0.38438746333122253, 0.3831562101840973, 0.3819258213043213, 0.3806963860988617, 0.37946775555610657, 0.3782399892807007, 0.37701308727264404, 0.37578707933425903, 0.37456193566322327, 0.3733377158641815, 0.37211430072784424, 0.3708917200565338, 0.369670033454895, 0.3684491813182831, 0.3672291934490204, 0.3660101294517517, 0.3647918701171875, 0.36357444524765015, 0.36235785484313965, 0.3611421287059784, 0.3599272668361664, 0.358713299036026, 0.3575001060962677, 0.35628777742385864, 0.35507628321647644, 0.3538656234741211, 0.3526557981967926, 0.35144680738449097, 0.35023871064186096, 0.34903138875961304, 0.34782490134239197, 0.34661924839019775, 0.345414400100708, 0.3442103862762451, 0.34300729632377625, 0.3418049216270447, 0.34060338139533997, 0.3394026756286621, 0.3382027745246887, 0.3370037078857422, 0.3358055055141449, 0.3346080482006073, 0.33341142535209656, 0.3322156071662903, 0.3310205638408661, 0.32982638478279114, 0.32863304018974304, 0.32744044065475464, 0.3262486457824707, 0.32505765557289124, 0.32386747002601624, 0.3226780891418457, 0.3214895725250244, 0.32030177116394043, 0.3191147744655609, 0.3179285526275635, 0.3167431354522705, 0.315558522939682, 0.31437474489212036, 0.3131917119026184, 0.31200945377349854, 0.31082797050476074, 0.30964726209640503, 0.3084673583507538, 0.3072882294654846, 0.3061099350452423, 0.3049323558807373, 0.3037555515766144, 0.3025795519351959, 0.30140429735183716, 0.3002298176288605, 0.29905617237091064, 0.2978832423686981, 0.2967110574245453, 0.29553964734077454, 0.29436901211738586, 0.2931991517543793, 0.29203009605407715, 0.29086172580718994, 0.2896941602230072, 0.28852730989456177, 0.2873612344264984, 0.28619590401649475, 0.28503140807151794, 0.28386759757995605, 0.28270453214645386, 0.28154221177101135, 0.2803806662559509, 0.2792198359966278, 0.27805984020233154, 0.2769005000591278, 0.27574193477630615, 0.2745840847492218, 0.27342697978019714, 0.2722706198692322, 0.27111509442329407, 0.2699601948261261, 0.2688060402870178, 0.26765263080596924]} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py new file mode 100644 index 000000000000..6074107ca942 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# @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. + +"""Generate fixtures.""" + +import os +import json +import numpy as np +from scipy.special import spence + +# Get the file path: +FILE = os.path.realpath(__file__) + +# Extract the directory in which this file resides: +DIR = os.path.dirname(FILE) + + +def gen(x, name): + """Generate fixture data and writes them to file. + + # Arguments + + * `x`: domain + * `name::str`: output filename + + # Examples + + ``` python + python> x = linspace(0.0, 1.0, 2001) + python> gen(x, './data.json') + ``` + """ + y = spence(x).astype(np.float32) + + # Store data to be written to file as a dictionary: + data = { + "x": x.tolist(), + "expected": y.tolist() + } + + # Based on the script directory, create an output filepath: + filepath = os.path.join(DIR, name) + + # Write the data to the output filepath as JSON: + with open(filepath, "w", encoding="utf-8") as outfile: + json.dump(data, outfile) + + +def main(): + """Generate fixture data.""" + x = np.linspace(0.0001, 0.25, 500, dtype=np.float32) + gen(x, "small.json") + + x = np.linspace(0.25, 0.75, 500, dtype=np.float32) + gen(x, "medium.json") + + x = np.linspace(0.75, 0.9999, 500, dtype=np.float32) + gen(x, "large.json") + + +if __name__ == "__main__": + main() diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/small.json b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/small.json new file mode 100644 index 000000000000..17e86fa197a3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/small.json @@ -0,0 +1 @@ +{"x": [9.999999747378752e-05, 0.0006008016061969101, 0.0011016031494364142, 0.001602404867298901, 0.002103206468746066, 0.0026040079537779093, 0.003104809671640396, 0.0036056111566722393, 0.0041064126417040825, 0.004607214592397213, 0.005108016077429056, 0.005608817562460899, 0.0061096190474927425, 0.006610420998185873, 0.007111222483217716, 0.007612023968249559, 0.008112825453281403, 0.008613627403974533, 0.009114428423345089, 0.00961523037403822, 0.01011603232473135, 0.010616833344101906, 0.011117635294795036, 0.011618437245488167, 0.012119238264858723, 0.012620040215551853, 0.013120841234922409, 0.01362164318561554, 0.01412244513630867, 0.014623246155679226, 0.015124048106372356, 0.015624850057065487, 0.016125651076436043, 0.016626453027129173, 0.017127254977822304, 0.017628056928515434, 0.018128857016563416, 0.018629658967256546, 0.019130460917949677, 0.019631262868642807, 0.020132064819335938, 0.02063286490738392, 0.02113366685807705, 0.02163446880877018, 0.02213527075946331, 0.02263607271015644, 0.02313687466084957, 0.023637674748897552, 0.024138476699590683, 0.024639278650283813, 0.025140080600976944, 0.025640882551670074, 0.026141682639718056, 0.026642484590411186, 0.027143286541104317, 0.027644088491797447, 0.028144890442490578, 0.02864569053053856, 0.02914649248123169, 0.02964729443192482, 0.03014809638261795, 0.03064889833331108, 0.03114970028400421, 0.03165050223469734, 0.03215130418539047, 0.032652102410793304, 0.033152904361486435, 0.033653706312179565, 0.034154508262872696, 0.034655310213565826, 0.03515611216425896, 0.03565691411495209, 0.03615771606564522, 0.03665851801633835, 0.03715931996703148, 0.03766012191772461, 0.03816092014312744, 0.03866172209382057, 0.0391625240445137, 0.03966332599520683, 0.04016412794589996, 0.040664929896593094, 0.041165731847286224, 0.041666533797979355, 0.042167335748672485, 0.042668137699365616, 0.043168939650058746, 0.04366973787546158, 0.04417053982615471, 0.04467134177684784, 0.04517214372754097, 0.0456729456782341, 0.04617374762892723, 0.04667454957962036, 0.04717535153031349, 0.04767615348100662, 0.04817695543169975, 0.048677753657102585, 0.049178555607795715, 0.049679357558488846, 0.050180159509181976, 0.05068096145987511, 0.05118176341056824, 0.05168256536126137, 0.0521833673119545, 0.05268416926264763, 0.05318497121334076, 0.05368577316403389, 0.05418657138943672, 0.05468737334012985, 0.05518817529082298, 0.05568897724151611, 0.056189779192209244, 0.056690581142902374, 0.057191383093595505, 0.057692185044288635, 0.058192986994981766, 0.058693788945674896, 0.05919459089636803, 0.05969538912177086, 0.06019619107246399, 0.06069699302315712, 0.06119779497385025, 0.06169859692454338, 0.06219939887523651, 0.06270019710063934, 0.06320100277662277, 0.0637018010020256, 0.06420260667800903, 0.06470340490341187, 0.0652042105793953, 0.06570500880479813, 0.06620581448078156, 0.06670661270618439, 0.06720741838216782, 0.06770821660757065, 0.06820901483297348, 0.06870982050895691, 0.06921061873435974, 0.06971142441034317, 0.070212222635746, 0.07071302831172943, 0.07121382653713226, 0.07171463221311569, 0.07221543043851852, 0.07271623611450195, 0.07321703433990479, 0.07371783256530762, 0.07421863824129105, 0.07471943646669388, 0.07522024214267731, 0.07572104036808014, 0.07622184604406357, 0.0767226442694664, 0.07722344994544983, 0.07772424817085266, 0.0782250463962555, 0.07872585207223892, 0.07922665029764175, 0.07972745597362518, 0.08022825419902802, 0.08072905987501144, 0.08122985810041428, 0.0817306637763977, 0.08223146200180054, 0.08273226767778397, 0.0832330659031868, 0.08373386412858963, 0.08423466980457306, 0.08473546802997589, 0.08523627370595932, 0.08573707193136215, 0.08623787760734558, 0.08673867583274841, 0.08723948150873184, 0.08774027973413467, 0.0882410854101181, 0.08874188363552094, 0.08924268186092377, 0.0897434875369072, 0.09024428576231003, 0.09074509143829346, 0.09124588966369629, 0.09174669533967972, 0.09224749356508255, 0.09274829924106598, 0.09324909746646881, 0.09374990314245224, 0.09425070136785507, 0.0947514995932579, 0.09525230526924133, 0.09575310349464417, 0.0962539091706276, 0.09675470739603043, 0.09725551307201385, 0.09775631129741669, 0.09825711697340012, 0.09875791519880295, 0.09925872087478638, 0.09975951910018921, 0.10026031732559204, 0.10076112300157547, 0.1012619212269783, 0.10176272690296173, 0.10226352512836456, 0.10276433080434799, 0.10326512902975082, 0.10376593470573425, 0.10426673293113708, 0.10476753860712051, 0.10526833683252335, 0.10576913505792618, 0.1062699407339096, 0.10677073895931244, 0.10727154463529587, 0.1077723428606987, 0.10827314853668213, 0.10877394676208496, 0.10927475243806839, 0.10977555066347122, 0.11027635633945465, 0.11077715456485748, 0.11127795279026031, 0.11177875846624374, 0.11227955669164658, 0.11278036236763, 0.11328116059303284, 0.11378196626901627, 0.1142827644944191, 0.11478357017040253, 0.11528436839580536, 0.11578516662120819, 0.11628597229719162, 0.11678677052259445, 0.11728757619857788, 0.11778837442398071, 0.11828918009996414, 0.11878997832536697, 0.1192907840013504, 0.11979158222675323, 0.12029238790273666, 0.1207931861281395, 0.12129398435354233, 0.12179479002952576, 0.12229558825492859, 0.12279639393091202, 0.12329719215631485, 0.12379799783229828, 0.12429879605770111, 0.12479960173368454, 0.12530040740966797, 0.1258012056350708, 0.12630200386047363, 0.12680280208587646, 0.1273036003112793, 0.12780441343784332, 0.12830521166324615, 0.128806009888649, 0.12930680811405182, 0.12980762124061584, 0.13030841946601868, 0.1308092176914215, 0.13131001591682434, 0.13181082904338837, 0.1323116272687912, 0.13281242549419403, 0.13331322371959686, 0.1338140219449997, 0.13431483507156372, 0.13481563329696655, 0.13531643152236938, 0.13581722974777222, 0.13631804287433624, 0.13681884109973907, 0.1373196393251419, 0.13782043755054474, 0.13832123577594757, 0.1388220489025116, 0.13932284712791443, 0.13982364535331726, 0.1403244435787201, 0.14082525670528412, 0.14132605493068695, 0.14182685315608978, 0.14232765138149261, 0.14282844960689545, 0.14332926273345947, 0.1438300609588623, 0.14433085918426514, 0.14483165740966797, 0.145332470536232, 0.14583326876163483, 0.14633406698703766, 0.1468348652124405, 0.14733567833900452, 0.14783647656440735, 0.14833727478981018, 0.148838073015213, 0.14933887124061584, 0.14983968436717987, 0.1503404825925827, 0.15084128081798553, 0.15134207904338837, 0.1518428921699524, 0.15234369039535522, 0.15284448862075806, 0.1533452868461609, 0.15384608507156372, 0.15434689819812775, 0.15484769642353058, 0.1553484946489334, 0.15584929287433624, 0.15635010600090027, 0.1568509042263031, 0.15735170245170593, 0.15785250067710876, 0.1583533138036728, 0.15885411202907562, 0.15935491025447845, 0.1598557084798813, 0.16035650670528412, 0.16085731983184814, 0.16135811805725098, 0.1618589162826538, 0.16235971450805664, 0.16286052763462067, 0.1633613258600235, 0.16386212408542633, 0.16436292231082916, 0.164863720536232, 0.16536453366279602, 0.16586533188819885, 0.16636613011360168, 0.16686692833900452, 0.16736774146556854, 0.16786853969097137, 0.1683693379163742, 0.16887013614177704, 0.16937094926834106, 0.1698717474937439, 0.17037254571914673, 0.17087334394454956, 0.1713741421699524, 0.17187495529651642, 0.17237575352191925, 0.17287655174732208, 0.17337734997272491, 0.17387816309928894, 0.17437896132469177, 0.1748797595500946, 0.17538055777549744, 0.17588135600090027, 0.1763821691274643, 0.17688296735286713, 0.17738376557826996, 0.1778845638036728, 0.17838537693023682, 0.17888617515563965, 0.17938697338104248, 0.1798877716064453, 0.18038856983184814, 0.18088938295841217, 0.181390181183815, 0.18189097940921783, 0.18239177763462067, 0.1828925907611847, 0.18339338898658752, 0.18389418721199036, 0.1843949854373932, 0.18489579856395721, 0.18539659678936005, 0.18589739501476288, 0.1863981932401657, 0.18689899146556854, 0.18739980459213257, 0.1879006028175354, 0.18840140104293823, 0.18890219926834106, 0.1894030123949051, 0.18990381062030792, 0.19040460884571075, 0.1909054070711136, 0.19140620529651642, 0.19190701842308044, 0.19240781664848328, 0.1929086148738861, 0.19340941309928894, 0.19391022622585297, 0.1944110244512558, 0.19491182267665863, 0.19541262090206146, 0.1959134340286255, 0.19641423225402832, 0.19691503047943115, 0.19741582870483398, 0.19791662693023682, 0.19841744005680084, 0.19891823828220367, 0.1994190365076065, 0.19991983473300934, 0.20042064785957336, 0.2009214460849762, 0.20142224431037903, 0.20192304253578186, 0.2024238407611847, 0.20292465388774872, 0.20342545211315155, 0.20392625033855438, 0.20442704856395721, 0.20492786169052124, 0.20542865991592407, 0.2059294581413269, 0.20643025636672974, 0.20693106949329376, 0.2074318677186966, 0.20793266594409943, 0.20843346416950226, 0.2089342623949051, 0.20943507552146912, 0.20993587374687195, 0.21043667197227478, 0.2109374701976776, 0.21143828332424164, 0.21193908154964447, 0.2124398797750473, 0.21294067800045013, 0.21344147622585297, 0.213942289352417, 0.21444308757781982, 0.21494388580322266, 0.2154446840286255, 0.21594549715518951, 0.21644629538059235, 0.21694709360599518, 0.217447891831398, 0.21794869005680084, 0.21844950318336487, 0.2189503014087677, 0.21945109963417053, 0.21995189785957336, 0.2204527109861374, 0.22095350921154022, 0.22145430743694305, 0.2219551056623459, 0.2224559187889099, 0.22295671701431274, 0.22345751523971558, 0.2239583134651184, 0.22445911169052124, 0.22495992481708527, 0.2254607230424881, 0.22596152126789093, 0.22646231949329376, 0.2269631326198578, 0.22746393084526062, 0.22796472907066345, 0.22846552729606628, 0.22896632552146912, 0.22946713864803314, 0.22996793687343597, 0.2304687350988388, 0.23096953332424164, 0.23147034645080566, 0.2319711446762085, 0.23247194290161133, 0.23297274112701416, 0.23347355425357819, 0.23397435247898102, 0.23447515070438385, 0.23497594892978668, 0.23547674715518951, 0.23597756028175354, 0.23647835850715637, 0.2369791567325592, 0.23747995495796204, 0.23798076808452606, 0.2384815663099289, 0.23898236453533173, 0.23948316276073456, 0.2399839609861374, 0.24048477411270142, 0.24098557233810425, 0.24148637056350708, 0.2419871687889099, 0.24248798191547394, 0.24298878014087677, 0.2434895783662796, 0.24399037659168243, 0.24449118971824646, 0.2449919879436493, 0.24549278616905212, 0.24599358439445496, 0.2464943826198578, 0.24699519574642181, 0.24749599397182465, 0.24799679219722748, 0.2484975904226303, 0.24899840354919434, 0.24949920177459717, 0.25], "expected": [1.6439130306243896, 1.6398755311965942, 1.6363250017166138, 1.6330093145370483, 1.6298513412475586, 1.62681245803833, 1.6238692998886108, 1.6210060119628906, 1.6182113885879517, 1.6154768466949463, 1.6127957105636597, 1.6101627349853516, 1.607573390007019, 1.6050240993499756, 1.6025117635726929, 1.6000337600708008, 1.5975878238677979, 1.5951716899871826, 1.592783808708191, 1.590422511100769, 1.5880863666534424, 1.5857740640640259, 1.5834845304489136, 1.5812166929244995, 1.5789694786071777, 1.5767420530319214, 1.5745337009429932, 1.5723437070846558, 1.5701711177825928, 1.568015456199646, 1.5658762454986572, 1.5637526512145996, 1.5616443157196045, 1.5595507621765137, 1.557471513748169, 1.555406093597412, 1.553354024887085, 1.5513150691986084, 1.5492888689041138, 1.5472748279571533, 1.545272946357727, 1.5432827472686768, 1.5413038730621338, 1.539336085319519, 1.537379264831543, 1.5354329347610474, 1.5334969758987427, 1.5315711498260498, 1.5296552181243896, 1.527748942375183, 1.525852084159851, 1.523964524269104, 1.5220860242843628, 1.520216464996338, 1.5183554887771606, 1.5165032148361206, 1.5146591663360596, 1.512823462486267, 1.5109957456588745, 1.5091760158538818, 1.50736403465271, 1.5055596828460693, 1.5037628412246704, 1.5019733905792236, 1.5001912117004395, 1.4984161853790283, 1.4966481924057007, 1.494887113571167, 1.4931327104568481, 1.4913851022720337, 1.489644169807434, 1.4879095554351807, 1.4861814975738525, 1.484459638595581, 1.4827439785003662, 1.481034517288208, 1.4793310165405273, 1.4776335954666138, 1.4759418964385986, 1.4742560386657715, 1.4725757837295532, 1.4709012508392334, 1.4692323207855225, 1.4675688743591309, 1.465910792350769, 1.464258074760437, 1.4626106023788452, 1.4609683752059937, 1.4593312740325928, 1.457699179649353, 1.456072211265564, 1.4544501304626465, 1.4528330564498901, 1.4512207508087158, 1.449613332748413, 1.4480105638504028, 1.446412444114685, 1.4448189735412598, 1.443230152130127, 1.441645860671997, 1.4400659799575806, 1.4384905099868774, 1.4369194507598877, 1.4353528022766113, 1.4337903261184692, 1.4322322607040405, 1.4306782484054565, 1.4291284084320068, 1.4275827407836914, 1.4260411262512207, 1.4245035648345947, 1.422969937324524, 1.4214403629302979, 1.4199146032333374, 1.4183928966522217, 1.416874885559082, 1.415360689163208, 1.4138503074645996, 1.4123436212539673, 1.410840630531311, 1.4093413352966309, 1.4078457355499268, 1.4063537120819092, 1.4048651456832886, 1.403380274772644, 1.4018988609313965, 1.400420904159546, 1.3989464044570923, 1.397475242614746, 1.3960075378417969, 1.394543170928955, 1.3930821418762207, 1.3916244506835938, 1.3901699781417847, 1.388718843460083, 1.3872709274291992, 1.3858261108398438, 1.3843845129013062, 1.3829460144042969, 1.3815107345581055, 1.3800784349441528, 1.378649353981018, 1.377223253250122, 1.3758001327514648, 1.3743799924850464, 1.3729628324508667, 1.3715487718582153, 1.3701374530792236, 1.3687291145324707, 1.3673237562179565, 1.365921139717102, 1.3645215034484863, 1.3631246089935303, 1.3617304563522339, 1.3603391647338867, 1.3589506149291992, 1.357564926147461, 1.3561818599700928, 1.3548014163970947, 1.353423833847046, 1.3520487546920776, 1.350676417350769, 1.3493067026138306, 1.3479396104812622, 1.346575140953064, 1.3452131748199463, 1.3438538312911987, 1.3424969911575317, 1.3411427736282349, 1.339790940284729, 1.3384417295455933, 1.3370949029922485, 1.3357505798339844, 1.3344086408615112, 1.3330692052841187, 1.331732153892517, 1.3303974866867065, 1.329065203666687, 1.3277353048324585, 1.326407790184021, 1.3250826597213745, 1.32375967502594, 1.322439193725586, 1.3211208581924438, 1.3198049068450928, 1.3184912204742432, 1.317179799079895, 1.3158705234527588, 1.314563512802124, 1.3132587671279907, 1.3119562864303589, 1.3106558322906494, 1.3093576431274414, 1.3080615997314453, 1.3067677021026611, 1.3054760694503784, 1.304186463356018, 1.30289888381958, 1.3016135692596436, 1.3003301620483398, 1.2990490198135376, 1.2977697849273682, 1.2964926958084106, 1.2952176332473755, 1.2939447164535522, 1.2926737070083618, 1.2914047241210938, 1.2901376485824585, 1.2888727188110352, 1.2876096963882446, 1.286348581314087, 1.2850894927978516, 1.283832311630249, 1.2825771570205688, 1.2813239097595215, 1.2800724506378174, 1.2788230180740356, 1.2775754928588867, 1.276329755783081, 1.2750860452651978, 1.2738440036773682, 1.272603988647461, 1.271365761756897, 1.2701293230056763, 1.2688947916030884, 1.2676620483398438, 1.2664310932159424, 1.2652020454406738, 1.263974666595459, 1.2627490758895874, 1.2615253925323486, 1.2603033781051636, 1.2590831518173218, 1.2578645944595337, 1.2566478252410889, 1.2554328441619873, 1.2542195320129395, 1.2530078887939453, 1.2517980337142944, 1.2505898475646973, 1.2493834495544434, 1.2481786012649536, 1.2469755411148071, 1.2457740306854248, 1.2445741891860962, 1.2433760166168213, 1.2421796321868896, 1.2409846782684326, 1.2397915124893188, 1.2385998964309692, 1.2374098300933838, 1.236221432685852, 1.235034704208374, 1.2338495254516602, 1.2326658964157104, 1.231483817100525, 1.230303406715393, 1.2291245460510254, 1.2279471158981323, 1.226771354675293, 1.2255971431732178, 1.2244244813919067, 1.2232532501220703, 1.222083568572998, 1.22091543674469, 1.219748854637146, 1.2185837030410767, 1.2174201011657715, 1.216257929801941, 1.2150973081588745, 1.2139381170272827, 1.212780475616455, 1.211624264717102, 1.2104694843292236, 1.2093161344528198, 1.2081643342971802, 1.2070139646530151, 1.2058649063110352, 1.2047173976898193, 1.2035712003707886, 1.202426552772522, 1.2012832164764404, 1.2001413106918335, 1.1990008354187012, 1.1978617906570435, 1.1967240571975708, 1.1955876350402832, 1.1944527626037598, 1.1933192014694214, 1.192186951637268, 1.1910561323165894, 1.1899266242980957, 1.1887985467910767, 1.1876717805862427, 1.1865463256835938, 1.1854221820831299, 1.1842994689941406, 1.1831779479980469, 1.1820578575134277, 1.180938959121704, 1.179821491241455, 1.1787053346633911, 1.1775903701782227, 1.1764768362045288, 1.1753644943237305, 1.1742534637451172, 1.173143744468689, 1.1720352172851562, 1.1709280014038086, 1.169822096824646, 1.168717384338379, 1.1676139831542969, 1.1665117740631104, 1.1654108762741089, 1.164311170578003, 1.163212776184082, 1.1621155738830566, 1.1610195636749268, 1.159924864768982, 1.1588313579559326, 1.1577390432357788, 1.1566479206085205, 1.1555579900741577, 1.15446937084198, 1.1533818244934082, 1.152295470237732, 1.1512104272842407, 1.1501264572143555, 1.1490437984466553, 1.147962212562561, 1.1468818187713623, 1.145802617073059, 1.1447244882583618, 1.1436476707458496, 1.1425719261169434, 1.141497254371643, 1.1404238939285278, 1.1393516063690186, 1.1382803916931152, 1.1372103691101074, 1.1361415386199951, 1.1350737810134888, 1.134007215499878, 1.1329416036605835, 1.1318773031234741, 1.1308139562606812, 1.1297518014907837, 1.1286907196044922, 1.1276308298110962, 1.1265720129013062, 1.125514268875122, 1.124457597732544, 1.1234019994735718, 1.1223474740982056, 1.1212941408157349, 1.1202417612075806, 1.1191904544830322, 1.1181403398513794, 1.117091178894043, 1.116043210029602, 1.1149961948394775, 1.113950252532959, 1.1129053831100464, 1.1118614673614502, 1.1108187437057495, 1.1097769737243652, 1.108736276626587, 1.1076966524124146, 1.1066579818725586, 1.1056203842163086, 1.1045838594436646, 1.103548288345337, 1.1025137901306152, 1.10148024559021, 1.100447654724121, 1.0994162559509277, 1.0983858108520508, 1.0973563194274902, 1.096327781677246, 1.095300316810608, 1.0942738056182861, 1.0932483673095703, 1.092223882675171, 1.091200351715088, 1.0901777744293213, 1.0891562700271606, 1.0881357192993164, 1.0871161222457886, 1.0860974788665771, 1.0850797891616821, 1.084063172340393, 1.0830473899841309, 1.0820326805114746, 1.0810188055038452, 1.0800060033798218, 1.0789940357208252, 1.0779831409454346, 1.0769730806350708, 1.0759639739990234, 1.074955940246582, 1.073948621749878, 1.0729423761367798, 1.071937084197998, 1.0709327459335327, 1.0699292421340942, 1.0689266920089722, 1.0679250955581665, 1.0669243335723877, 1.0659245252609253, 1.0649256706237793, 1.0639276504516602, 1.062930703163147, 1.061934471130371, 1.0609391927719116, 1.0599448680877686, 1.0589513778686523, 1.0579588413238525, 1.0569672584533691, 1.055976390838623, 1.0549864768981934, 1.05399751663208, 1.0530093908309937, 1.052022099494934, 1.051035761833191, 1.0500502586364746, 1.0490657091140747, 1.0480819940567017, 1.047098994255066, 1.0461170673370361, 1.0451358556747437, 1.0441555976867676, 1.0431761741638184, 1.042197585105896, 1.0412198305130005, 1.0402430295944214, 1.0392669439315796, 1.0382918119430542, 1.0373173952102661, 1.0363439321517944, 1.0353713035583496, 1.0343995094299316, 1.0334285497665405, 1.0324584245681763, 1.0314890146255493, 1.0305205583572388, 1.029552936553955, 1.0285860300064087, 1.0276200771331787, 1.026654839515686, 1.0256904363632202, 1.0247269868850708, 1.0237642526626587, 1.0228022336959839, 1.0218411684036255, 1.0208808183670044, 1.0199213027954102, 1.0189626216888428, 1.0180046558380127, 1.0170475244522095, 1.016091227531433, 1.0151357650756836, 1.0141810178756714, 1.013227105140686, 1.012273907661438, 1.0113215446472168, 1.0103700160980225, 1.0094192028045654, 1.0084692239761353, 1.0075199604034424, 1.0065715312957764, 1.0056238174438477, 1.0046769380569458, 1.0037307739257812, 1.0027854442596436, 1.0018408298492432, 1.00089693069458, 0.9999538660049438, 0.9990115761756897, 0.9980700016021729, 0.9971292018890381, 0.9961891174316406, 0.99524986743927, 0.9943113327026367, 0.9933735132217407, 0.9924364686012268, 0.991500198841095, 0.9905646443367004, 0.989629864692688, 0.9886957406997681, 0.987762451171875, 0.9868298172950745, 0.9858980178833008, 0.9849668741226196, 0.9840364456176758, 0.983106791973114, 0.9821778535842896, 0.9812496900558472, 0.9803221821784973, 0.9793954491615295, 0.9784693717956543]} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js new file mode 100644 index 000000000000..acc6a76e661c --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js @@ -0,0 +1,134 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var absf = require( '@stdlib/math/base/special/absf' ); +var PI_SQUARED = require( '@stdlib/constants/float32/pi-squared' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var spencef = require( './../lib' ); + + +// FIXTURES // + +var small = require( './fixtures/python/small.json' ); +var medium = require( './fixtures/python/medium.json' ); +var large = require( './fixtures/python/large.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof spencef, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for small positive numbers', function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = small.x; + expected = small.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = 1.3 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for medium positive numbers', function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = medium.x; + expected = medium.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = 1.8 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for large positive numbers', function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = large.x; + expected = large.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + +tape( 'the function returns `0.0` if provided `1.0` for `x`', function test( t ) { + var val = spencef( 1.0 ); + t.strictEqual( val, 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `PI^2/6` if provided `0.0` for `x`', function test( t ) { + var val = spencef( 0.0 ); + t.strictEqual( val, float64ToFloat32( PI_SQUARED/6.0 ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `NaN` for negative numbers', function test( t ) { + var val; + var x; + + for ( x = -100; x < 0; x++ ) { + val = spencef( x ); + t.strictEqual( isnanf( val ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { + var val = spencef( NaN ); + t.strictEqual( isnanf( val ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js new file mode 100644 index 000000000000..5c895242fdd2 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js @@ -0,0 +1,145 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var absf = require( '@stdlib/math/base/special/absf' ); +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var PI_SQUARED = require( '@stdlib/constants/float32/pi-squared' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// FIXTURES // + +var small = require( './fixtures/python/small.json' ); +var medium = require( './fixtures/python/medium.json' ); +var large = require( './fixtures/python/large.json' ); + + +// VARIABLES // + +var spencef = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( spencef instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof spencef, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for small positive numbers', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = small.x; + expected = small.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = 1.3 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Tolerance: ' + tol + '.' ); + } + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for medium positive numbers', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = medium.x; + expected = medium.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 + tol = 7.2 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + +tape( 'the function accurately computes the dilogarithm for large positive numbers', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = large.x; + expected = large.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = 2.0 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + +tape( 'the function returns `0.0` if provided `1.0` for `x`', opts, function test( t ) { + var val = spencef( 1.0 ); + t.strictEqual( val, 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `PI^2/6` if provided `0.0` for `x`', opts, function test( t ) { + var val = spencef( 0.0 ); + t.strictEqual( val, float64ToFloat32( PI_SQUARED/6.0 ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `NaN` for negative numbers', opts, function test( t ) { + var val; + var x; + + for ( x = -100; x < 0; x++ ) { + val = spencef( x ); + t.strictEqual( isnanf( val ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { + var val = spencef( NaN ); + t.strictEqual( isnanf( val ), true, 'returns expected value' ); + t.end(); +}); From c77f1c865dd9134f5156b58ebd867ea229f45b20 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 20 May 2025 06:52:45 +0000 Subject: [PATCH 2/5] chore: update copyright years --- lib/node_modules/@stdlib/math/base/special/spencef/README.md | 2 +- .../@stdlib/math/base/special/spencef/benchmark/benchmark.js | 2 +- .../math/base/special/spencef/benchmark/benchmark.native.js | 2 +- .../math/base/special/spencef/benchmark/c/native/Makefile | 2 +- .../math/base/special/spencef/benchmark/c/native/benchmark.c | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp | 2 +- .../@stdlib/math/base/special/spencef/docs/types/index.d.ts | 2 +- .../@stdlib/math/base/special/spencef/docs/types/test.ts | 2 +- .../@stdlib/math/base/special/spencef/examples/c/Makefile | 2 +- .../@stdlib/math/base/special/spencef/examples/c/example.c | 2 +- .../@stdlib/math/base/special/spencef/examples/index.js | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/include.gypi | 2 +- .../special/spencef/include/stdlib/math/base/special/spencef.h | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js | 2 +- .../@stdlib/math/base/special/spencef/lib/native.js | 2 +- .../@stdlib/math/base/special/spencef/scripts/evalpoly.js | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/src/main.c | 2 +- .../math/base/special/spencef/test/fixtures/python/runner.py | 2 +- lib/node_modules/@stdlib/math/base/special/spencef/test/test.js | 2 +- .../@stdlib/math/base/special/spencef/test/test.native.js | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/README.md b/lib/node_modules/@stdlib/math/base/special/spencef/README.md index 881429a896f8..fd83d97944ad 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/README.md +++ b/lib/node_modules/@stdlib/math/base/special/spencef/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2025 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js index 9e76c24c4abe..d6e4a436b02b 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js index 1006c147ab17..7288a808d6f2 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile index f69e9da2b4d3..a4bd7b38fd74 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c index 24b674da3a11..63f5441ad050 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/spencef/benchmark/c/native/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp b/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp index ec3992233442..68a1ca11d160 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp +++ b/lib/node_modules/@stdlib/math/base/special/spencef/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts index ca00bb57a30d..79262020b38d 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts index 7a3e502c445d..7ccadb12ef10 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts +++ b/lib/node_modules/@stdlib/math/base/special/spencef/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile index 6aed70daf167..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c index 72a5ae66198b..acf4c5366f1f 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js b/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js index b5a0b4b870ab..e3cd88baaddd 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi b/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi index 575cb043c0bf..ecfaf82a3279 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi +++ b/lib/node_modules/@stdlib/math/base/special/spencef/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/include/stdlib/math/base/special/spencef.h b/lib/node_modules/@stdlib/math/base/special/spencef/include/stdlib/math/base/special/spencef.h index ce6d5e62670f..ed70a7c76234 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/include/stdlib/math/base/special/spencef.h +++ b/lib/node_modules/@stdlib/math/base/special/spencef/include/stdlib/math/base/special/spencef.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js index cc365c7924ba..fdf845c0bc13 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js index cad160c5ac7a..c6ce786f53a1 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js index 13995b280e4e..cb4fe06b39c8 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js b/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js index f8ccf083e219..eb78e2f23dfb 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/scripts/evalpoly.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile b/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile index bcf18aa46655..7733b6180cb4 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/spencef/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c b/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c index 9cdee4858555..fb37fbde5c29 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c +++ b/lib/node_modules/@stdlib/math/base/special/spencef/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c b/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c index 53edbae3c5dd..6ab28a39e758 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/spencef/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py index 6074107ca942..9980fa2f39be 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py @@ -2,7 +2,7 @@ # # @license Apache-2.0 # -# Copyright (c) 2018 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js index acc6a76e661c..855b867eeac6 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js index 5c895242fdd2..f16748f3e452 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 6d233a4dd372f1ba838d6e3ee3860b9f6c8b0302 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Tue, 20 May 2025 00:01:07 -0700 Subject: [PATCH 3/5] test: increase test tolerance --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/spencef/test/test.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js index f16748f3e452..c44137a2bb39 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js @@ -89,7 +89,7 @@ tape( 'the function accurately computes the dilogarithm for medium positive numb delta = absf( v - expected[ i ] ); // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 - tol = 7.2 * EPS * absf( expected[ i ] ); + tol = 8.2 * EPS * absf( expected[ i ] ); t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); } t.end(); From 5f84d1600d57b92fb03bac6cf9ea67e303a2a509 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Tue, 20 May 2025 00:16:01 -0700 Subject: [PATCH 4/5] test: add tests to achieve 100% code coverage --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: passed - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../spencef/test/fixtures/python/huge.json | 1 + .../spencef/test/fixtures/python/runner.py | 3 +++ .../math/base/special/spencef/test/test.js | 21 +++++++++++++++++ .../base/special/spencef/test/test.native.js | 23 +++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/huge.json diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/huge.json b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/huge.json new file mode 100644 index 000000000000..b9ca5d7552c3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/huge.json @@ -0,0 +1 @@ +{"x": [1.0, 1.0040080547332764, 1.0080159902572632, 1.0120240449905396, 1.016032099723816, 1.0200400352478027, 1.024048089981079, 1.0280561447143555, 1.0320640802383423, 1.0360721349716187, 1.040080189704895, 1.0440881252288818, 1.0480961799621582, 1.0521042346954346, 1.0561121702194214, 1.0601202249526978, 1.0641282796859741, 1.068136215209961, 1.0721442699432373, 1.0761523246765137, 1.08016037940979, 1.0841683149337769, 1.0881763696670532, 1.0921844244003296, 1.0961923599243164, 1.1002004146575928, 1.1042084693908691, 1.108216404914856, 1.1122244596481323, 1.1162325143814087, 1.1202404499053955, 1.1242485046386719, 1.1282565593719482, 1.132264494895935, 1.1362725496292114, 1.1402806043624878, 1.1442885398864746, 1.148296594619751, 1.1523046493530273, 1.1563125848770142, 1.1603206396102905, 1.164328694343567, 1.1683366298675537, 1.17234468460083, 1.1763527393341064, 1.1803606748580933, 1.1843687295913696, 1.188376784324646, 1.1923847198486328, 1.1963927745819092, 1.2004008293151855, 1.2044087648391724, 1.2084168195724487, 1.212424874305725, 1.216432809829712, 1.2204408645629883, 1.2244489192962646, 1.2284568548202515, 1.2324649095535278, 1.2364729642868042, 1.2404810190200806, 1.2444889545440674, 1.2484970092773438, 1.2525050640106201, 1.256512999534607, 1.2605210542678833, 1.2645291090011597, 1.2685370445251465, 1.2725450992584229, 1.2765531539916992, 1.280561089515686, 1.2845691442489624, 1.2885771989822388, 1.2925851345062256, 1.296593189239502, 1.3006012439727783, 1.3046091794967651, 1.3086172342300415, 1.3126252889633179, 1.3166332244873047, 1.320641279220581, 1.3246493339538574, 1.3286572694778442, 1.3326653242111206, 1.336673378944397, 1.3406813144683838, 1.3446893692016602, 1.3486974239349365, 1.3527053594589233, 1.3567134141921997, 1.360721468925476, 1.364729404449463, 1.3687374591827393, 1.3727455139160156, 1.3767534494400024, 1.3807615041732788, 1.3847695589065552, 1.3887776136398315, 1.3927855491638184, 1.3967936038970947, 1.400801658630371, 1.404809594154358, 1.4088176488876343, 1.4128257036209106, 1.4168336391448975, 1.4208416938781738, 1.4248497486114502, 1.428857684135437, 1.4328657388687134, 1.4368737936019897, 1.4408817291259766, 1.444889783859253, 1.4488978385925293, 1.4529057741165161, 1.4569138288497925, 1.4609218835830688, 1.4649298191070557, 1.468937873840332, 1.4729459285736084, 1.4769538640975952, 1.4809619188308716, 1.484969973564148, 1.4889779090881348, 1.4929859638214111, 1.4969940185546875, 1.5010019540786743, 1.5050100088119507, 1.509018063545227, 1.5130259990692139, 1.5170340538024902, 1.5210421085357666, 1.5250500440597534, 1.5290580987930298, 1.5330661535263062, 1.537074089050293, 1.5410821437835693, 1.5450901985168457, 1.549098253250122, 1.5531061887741089, 1.5571142435073853, 1.5611222982406616, 1.5651302337646484, 1.5691382884979248, 1.5731463432312012, 1.577154278755188, 1.5811623334884644, 1.5851703882217407, 1.5891783237457275, 1.593186378479004, 1.5971944332122803, 1.601202368736267, 1.6052104234695435, 1.6092184782028198, 1.6132264137268066, 1.617234468460083, 1.6212425231933594, 1.6252504587173462, 1.6292585134506226, 1.633266568183899, 1.6372745037078857, 1.641282558441162, 1.6452906131744385, 1.6492985486984253, 1.6533066034317017, 1.657314658164978, 1.6613225936889648, 1.6653306484222412, 1.6693387031555176, 1.6733466386795044, 1.6773546934127808, 1.6813627481460571, 1.685370683670044, 1.6893787384033203, 1.6933867931365967, 1.697394847869873, 1.7014027833938599, 1.7054108381271362, 1.7094188928604126, 1.7134268283843994, 1.7174348831176758, 1.7214429378509521, 1.725450873374939, 1.7294589281082153, 1.7334669828414917, 1.7374749183654785, 1.7414829730987549, 1.7454910278320312, 1.749498963356018, 1.7535070180892944, 1.7575150728225708, 1.7615230083465576, 1.765531063079834, 1.7695391178131104, 1.7735470533370972, 1.7775551080703735, 1.78156316280365, 1.7855710983276367, 1.789579153060913, 1.7935872077941895, 1.7975951433181763, 1.8016031980514526, 1.805611252784729, 1.8096191883087158, 1.8136272430419922, 1.8176352977752686, 1.8216432332992554, 1.8256512880325317, 1.829659342765808, 1.833667278289795, 1.8376753330230713, 1.8416833877563477, 1.8456913232803345, 1.8496993780136108, 1.8537074327468872, 1.8577154874801636, 1.8617234230041504, 1.8657314777374268, 1.8697395324707031, 1.87374746799469, 1.8777555227279663, 1.8817635774612427, 1.8857715129852295, 1.8897795677185059, 1.8937876224517822, 1.897795557975769, 1.9018036127090454, 1.9058116674423218, 1.9098196029663086, 1.913827657699585, 1.9178357124328613, 1.9218436479568481, 1.9258517026901245, 1.9298597574234009, 1.9338676929473877, 1.937875747680664, 1.9418838024139404, 1.9458917379379272, 1.9498997926712036, 1.95390784740448, 1.9579157829284668, 1.9619238376617432, 1.9659318923950195, 1.9699398279190063, 1.9739478826522827, 1.977955937385559, 1.981963872909546, 1.9859719276428223, 1.9899799823760986, 1.9939879179000854, 1.9979959726333618, 2.0020039081573486, 2.006011962890625, 2.0100200176239014, 2.0140280723571777, 2.018036127090454, 2.0220441818237305, 2.0260519981384277, 2.030060052871704, 2.0340681076049805, 2.038076162338257, 2.042084217071533, 2.0460922718048096, 2.050100088119507, 2.054108142852783, 2.0581161975860596, 2.062124252319336, 2.0661323070526123, 2.0701403617858887, 2.074148178100586, 2.0781562328338623, 2.0821642875671387, 2.086172342300415, 2.0901803970336914, 2.0941884517669678, 2.098196506500244, 2.1022043228149414, 2.1062123775482178, 2.110220432281494, 2.1142284870147705, 2.118236541748047, 2.1222445964813232, 2.1262524127960205, 2.130260467529297, 2.1342685222625732, 2.1382765769958496, 2.142284631729126, 2.1462926864624023, 2.1503005027770996, 2.154308557510376, 2.1583166122436523, 2.1623246669769287, 2.166332721710205, 2.1703407764434814, 2.1743485927581787, 2.178356647491455, 2.1823647022247314, 2.186372756958008, 2.190380811691284, 2.1943888664245605, 2.198396682739258, 2.202404737472534, 2.2064127922058105, 2.210420846939087, 2.2144289016723633, 2.2184369564056396, 2.222444772720337, 2.2264528274536133, 2.2304608821868896, 2.234468936920166, 2.2384769916534424, 2.2424850463867188, 2.246493101119995, 2.2505009174346924, 2.2545089721679688, 2.258517026901245, 2.2625250816345215, 2.266533136367798, 2.270541191101074, 2.2745490074157715, 2.278557062149048, 2.282565116882324, 2.2865731716156006, 2.290581226348877, 2.2945892810821533, 2.2985970973968506, 2.302605152130127, 2.3066132068634033, 2.3106212615966797, 2.314629316329956, 2.3186373710632324, 2.3226451873779297, 2.326653242111206, 2.3306612968444824, 2.334669351577759, 2.338677406311035, 2.3426854610443115, 2.346693277359009, 2.350701332092285, 2.3547093868255615, 2.358717441558838, 2.3627254962921143, 2.3667335510253906, 2.370741367340088, 2.3747494220733643, 2.3787574768066406, 2.382765531539917, 2.3867735862731934, 2.3907816410064697, 2.394789695739746, 2.3987975120544434, 2.4028055667877197, 2.406813621520996, 2.4108216762542725, 2.414829730987549, 2.418837785720825, 2.4228456020355225, 2.426853656768799, 2.430861711502075, 2.4348697662353516, 2.438877820968628, 2.4428858757019043, 2.4468936920166016, 2.450901746749878, 2.4549098014831543, 2.4589178562164307, 2.462925910949707, 2.4669339656829834, 2.4709417819976807, 2.474949836730957, 2.4789578914642334, 2.4829659461975098, 2.486974000930786, 2.4909820556640625, 2.4949898719787598, 2.498997926712036, 2.5030059814453125, 2.507014036178589, 2.5110220909118652, 2.5150301456451416, 2.519037961959839, 2.5230460166931152, 2.5270540714263916, 2.531062126159668, 2.5350701808929443, 2.5390782356262207, 2.543086290359497, 2.5470941066741943, 2.5511021614074707, 2.555110216140747, 2.5591182708740234, 2.5631263256073, 2.567134380340576, 2.5711421966552734, 2.57515025138855, 2.579158306121826, 2.5831663608551025, 2.587174415588379, 2.5911824703216553, 2.5951902866363525, 2.599198341369629, 2.6032063961029053, 2.6072144508361816, 2.611222505569458, 2.6152305603027344, 2.6192383766174316, 2.623246431350708, 2.6272544860839844, 2.6312625408172607, 2.635270595550537, 2.6392786502838135, 2.6432864665985107, 2.647294521331787, 2.6513025760650635, 2.65531063079834, 2.659318685531616, 2.6633267402648926, 2.66733455657959, 2.671342611312866, 2.6753506660461426, 2.679358720779419, 2.6833667755126953, 2.6873748302459717, 2.691382646560669, 2.6953907012939453, 2.6993987560272217, 2.703406810760498, 2.7074148654937744, 2.711422920227051, 2.715430974960327, 2.7194387912750244, 2.723446846008301, 2.727454900741577, 2.7314629554748535, 2.73547101020813, 2.7394790649414062, 2.7434868812561035, 2.74749493598938, 2.7515029907226562, 2.7555110454559326, 2.759519100189209, 2.7635271549224854, 2.7675349712371826, 2.771543025970459, 2.7755510807037354, 2.7795591354370117, 2.783567190170288, 2.7875752449035645, 2.7915830612182617, 2.795591115951538, 2.7995991706848145, 2.803607225418091, 2.807615280151367, 2.8116233348846436, 2.815631151199341, 2.819639205932617, 2.8236472606658936, 2.82765531539917, 2.8316633701324463, 2.8356714248657227, 2.83967924118042, 2.8436872959136963, 2.8476953506469727, 2.851703405380249, 2.8557114601135254, 2.8597195148468018, 2.863727569580078, 2.8677353858947754, 2.8717434406280518, 2.875751495361328, 2.8797595500946045, 2.883767604827881, 2.8877756595611572, 2.8917834758758545, 2.895791530609131, 2.8997995853424072, 2.9038076400756836, 2.90781569480896, 2.9118237495422363, 2.9158315658569336, 2.91983962059021, 2.9238476753234863, 2.9278557300567627, 2.931863784790039, 2.9358718395233154, 2.9398796558380127, 2.943887710571289, 2.9478957653045654, 2.951903820037842, 2.955911874771118, 2.9599199295043945, 2.963927745819092, 2.967935800552368, 2.9719438552856445, 2.975951910018921, 2.9799599647521973, 2.9839680194854736, 2.987975835800171, 2.9919838905334473, 2.9959919452667236, 3.0], "expected": [0.0, -0.004004045855253935, -0.007999983616173267, -0.011988092213869095, -0.01596829667687416, -0.019940519705414772, -0.023905036970973015, -0.02786177396774292, -0.03181065246462822, -0.03575194627046585, -0.039685580879449844, -0.04361147806048393, -0.047529906034469604, -0.05144079402089119, -0.05534406006336212, -0.05923997238278389, -0.06312845647335052, -0.06700943410396576, -0.07088317722082138, -0.07474959641695023, -0.07860873639583588, -0.08246051520109177, -0.08630520105361938, -0.09014271199703217, -0.09397297352552414, -0.0977962389588356, -0.10161244124174118, -0.10542149841785431, -0.10922367125749588, -0.11301887035369873, -0.11680702865123749, -0.12058839946985245, -0.12436290830373764, -0.1281304657459259, -0.13189134001731873, -0.13564544916152954, -0.1393927037715912, -0.14313337206840515, -0.14686736464500427, -0.15059460699558258, -0.15431533753871918, -0.1580294966697693, -0.16173700988292694, -0.16543810069561005, -0.16913269460201263, -0.17282073199748993, -0.17650245130062103, -0.18017777800559998, -0.1838466078042984, -0.1875092089176178, -0.1911655068397522, -0.19481541216373444, -0.19845916330814362, -0.20209668576717377, -0.20572789013385773, -0.20935304462909698, -0.21297205984592438, -0.21658483147621155, -0.22019162774085999, -0.22379237413406372, -0.22738707065582275, -0.23097564280033112, -0.2345583438873291, -0.23813509941101074, -0.24170580506324768, -0.24527069926261902, -0.24882972240447998, -0.2523827850818634, -0.2559301257133484, -0.2594716548919678, -0.2630073130130768, -0.26653730869293213, -0.27006155252456665, -0.27358001470565796, -0.2770928740501404, -0.28060010075569153, -0.28410154581069946, -0.28759750723838806, -0.29108789563179016, -0.2945725917816162, -0.2980518639087677, -0.30152562260627747, -0.30499374866485596, -0.30845654010772705, -0.3119138479232788, -0.31536564230918884, -0.31881213188171387, -0.3222532272338867, -0.3256888687610626, -0.3291192650794983, -0.33254432678222656, -0.33596399426460266, -0.3393785059452057, -0.3427877426147461, -0.3461916446685791, -0.3495904505252838, -0.3529840409755707, -0.3563724756240845, -0.35975563526153564, -0.3631337881088257, -0.36650681495666504, -0.36987465620040894, -0.3732375204563141, -0.37659531831741333, -0.3799480199813843, -0.38329577445983887, -0.3866385519504547, -0.38997623324394226, -0.393309086561203, -0.3966369926929474, -0.39995986223220825, -0.4032779633998871, -0.40659117698669434, -0.40989941358566284, -0.4132029116153717, -0.41650161147117615, -0.41979536414146423, -0.42308446764945984, -0.426368772983551, -0.429648220539093, -0.4329230487346649, -0.43619316816329956, -0.4394584894180298, -0.4427191913127899, -0.44597527384757996, -0.44922658801078796, -0.45247337222099304, -0.455715537071228, -0.45895299315452576, -0.46218597888946533, -0.465414434671402, -0.46863821148872375, -0.47185754776000977, -0.47507238388061523, -0.478282630443573, -0.48148849606513977, -0.4846898913383484, -0.48788684606552124, -0.4910792410373688, -0.4942673444747925, -0.4974510371685028, -0.500630259513855, -0.5038051605224609, -0.5069757699966431, -0.510141909122467, -0.513303816318512, -0.5164614319801331, -0.5196146368980408, -0.5227636694908142, -0.5259084105491638, -0.5290488600730896, -0.5321851372718811, -0.5353171825408936, -0.5384449362754822, -0.5415686368942261, -0.5446881055831909, -0.5478033423423767, -0.5509145259857178, -0.5540215373039246, -0.5571243762969971, -0.5602232217788696, -0.5633178949356079, -0.5664084553718567, -0.5694950819015503, -0.5725775957107544, -0.575655996799469, -0.5787304639816284, -0.5818009376525879, -0.5848672986030579, -0.5879297852516174, -0.590988278388977, -0.5940427184104919, -0.5970933437347412, -0.6001400351524353, -0.6031827926635742, -0.6062215566635132, -0.6092565059661865, -0.6122875809669495, -0.6153147220611572, -0.6183380484580994, -0.6213575601577759, -0.624373197555542, -0.6273850202560425, -0.6303930878639221, -0.6333972811698914, -0.6363977789878845, -0.6393945217132568, -0.6423873901367188, -0.6453766226768494, -0.6483621001243591, -0.6513437628746033, -0.6543218493461609, -0.6572962403297424, -0.6602668166160583, -0.6632338166236877, -0.6661971807479858, -0.6691567897796631, -0.6721128225326538, -0.675065279006958, -0.6780140399932861, -0.6809592247009277, -0.6839008331298828, -0.6868388056755066, -0.6897732615470886, -0.6927041411399841, -0.6956314444541931, -0.6985552310943604, -0.7014755606651306, -0.7043921947479248, -0.7073054909706116, -0.7102152705192566, -0.7131214737892151, -0.7160242795944214, -0.7189236283302307, -0.7218195199966431, -0.7247118949890137, -0.7276009321212769, -0.7304865121841431, -0.7333686351776123, -0.7362474203109741, -0.7391228079795837, -0.7419947385787964, -0.7448633909225464, -0.747728705406189, -0.7505905032157898, -0.7534491419792175, -0.7563043832778931, -0.7591562271118164, -0.7620049118995667, -0.7648501992225647, -0.7676921486854553, -0.7705309391021729, -0.773366391658783, -0.7761985659599304, -0.77902752161026, -0.7818532586097717, -0.784675657749176, -0.7874948978424072, -0.7903109788894653, -0.793123722076416, -0.7959333658218384, -0.7987398505210876, -0.8015429973602295, -0.8043431043624878, -0.807140052318573, -0.8099337816238403, -0.8127244710922241, -0.81551194190979, -0.8182962536811829, -0.8210775852203369, -0.8238556385040283, -0.826630711555481, -0.8294026851654053, -0.832171618938446, -0.8349374532699585, -0.8377001881599426, -0.8404597640037537, -0.8432164192199707, -0.8459700345993042, -0.8487206697463989, -0.8514682054519653, -0.854212760925293, -0.8569541573524475, -0.8596927523612976, -0.8624283075332642, -0.8651609420776367, -0.8678905367851257, -0.8706172108650208, -0.8733407258987427, -0.8760614991188049, -0.8787792921066284, -0.8814942240715027, -0.8842061758041382, -0.8869152069091797, -0.889621376991272, -0.8923244476318359, -0.8950247764587402, -0.8977222442626953, -0.9004168510437012, -0.9031085968017578, -0.9057974219322205, -0.9084832668304443, -0.9111664295196533, -0.9138467907905579, -0.9165242910385132, -0.9191989302635193, -0.9218708276748657, -0.9245396852493286, -0.9272059202194214, -0.9298694133758545, -0.9325300455093384, -0.9351879358291626, -0.9378430843353271, -0.9404952526092529, -0.9431448578834534, -0.9457917213439941, -0.9484358429908752, -0.9510772228240967, -0.9537158608436584, -0.956351637840271, -0.9589848518371582, -0.9616153836250305, -0.9642431735992432, -0.9668682813644409, -0.9694907069206238, -0.9721102714538574, -0.9747273921966553, -0.9773417711257935, -0.9799535274505615, -0.9825626611709595, -0.9851691126823425, -0.9877729415893555, -0.990373969078064, -0.9929724931716919, -0.9955684542655945, -0.998161792755127, -1.000752568244934, -1.0033406019210815, -1.0059260129928589, -1.0085090398788452, -1.0110893249511719, -1.013667106628418, -1.0162423849105835, -1.018815040588379, -1.0213850736618042, -1.023952603340149, -1.026517629623413, -1.0290801525115967, -1.0316401720046997, -1.0341975688934326, -1.0367523431777954, -1.0393048524856567, -1.041854739189148, -1.0444021224975586, -1.0469471216201782, -1.0494894981384277, -1.0520293712615967, -1.0545668601989746, -1.057101845741272, -1.0596344470977783, -1.062164545059204, -1.0646922588348389, -1.0672173500061035, -1.0697401762008667, -1.0722604990005493, -1.074778437614441, -1.0772939920425415, -1.0798070430755615, -1.0823177099227905, -1.084825873374939, -1.087331771850586, -1.089835286140442, -1.0923364162445068, -1.0948351621627808, -1.0973315238952637, -1.099825382232666, -1.102316975593567, -1.1048063039779663, -1.1072932481765747, -1.109777808189392, -1.112260103225708, -1.1147398948669434, -1.1172174215316772, -1.1196926832199097, -1.1221656799316406, -1.1246362924575806, -1.127104640007019, -1.129570484161377, -1.132034182548523, -1.1344956159591675, -1.1369547843933105, -1.1394116878509521, -1.1418662071228027, -1.1443184614181519, -1.1467684507369995, -1.1492162942886353, -1.15166175365448, -1.1541050672531128, -1.1565461158752441, -1.1589847803115845, -1.1614214181900024, -1.163855791091919, -1.166287899017334, -1.1687177419662476, -1.1711454391479492, -1.173570990562439, -1.1759940385818481, -1.1784151792526245, -1.1808340549468994, -1.1832507848739624, -1.185665249824524, -1.1880775690078735, -1.1904876232147217, -1.1928956508636475, -1.1953015327453613, -1.1977051496505737, -1.2001066207885742, -1.2025060653686523, -1.2049031257629395, -1.2072981595993042, -1.2096911668777466, -1.212082028388977, -1.214470624923706, -1.2168571949005127, -1.2192414999008179, -1.2216238975524902, -1.2240041494369507, -1.2263822555541992, -1.2287583351135254, -1.2311322689056396, -1.2335039377212524, -1.2358736991882324, -1.23824143409729, -1.2406070232391357, -1.242970585823059, -1.2453320026397705, -1.24769127368927, -1.2500486373901367, -1.252403974533081, -1.254757285118103, -1.257108449935913, -1.2594575881958008, -1.2618046998977661, -1.264149785041809, -1.2664928436279297, -1.268833875656128, -1.2711730003356934, -1.2735099792480469, -1.2758450508117676, -1.2781778573989868, -1.2805088758468628, -1.2828378677368164, -1.2851649522781372, -1.2874900102615356, -1.2898130416870117, -1.2921339273452759, -1.2944531440734863, -1.2967702150344849, -1.2990853786468506, -1.3013986349105835, -1.303709864616394, -1.3060189485549927, -1.3083263635635376, -1.3106317520141602, -1.31293523311615, -1.3152366876602173, -1.3175362348556519, -1.319833755493164, -1.322129487991333, -1.3244233131408691, -1.3267152309417725, -1.3290051221847534, -1.3312932252883911, -1.333579182624817, -1.335863471031189, -1.3381458520889282, -1.3404263257980347, -1.3427048921585083, -1.3449815511703491, -1.3472561836242676, -1.3495291471481323, -1.3518002033233643, -1.3540693521499634, -1.3563367128372192, -1.3586021661758423, -1.3608657121658325, -1.3631272315979004, -1.365387201309204, -1.3676451444625854, -1.369901418685913, -1.3721556663513184, -1.37440824508667, -1.3766587972640991, -1.378907561302185, -1.3811545372009277, -1.3833998441696167, -1.3856431245803833, -1.3878847360610962, -1.3901243209838867, -1.3923622369766235, -1.394598364830017, -1.3968327045440674, -1.3990652561187744, -1.4012960195541382, -1.4035247564315796, -1.4057519435882568, -1.4079773426055908, -1.4102009534835815, -1.412422776222229, -1.4146428108215332, -1.4168609380722046, -1.4190775156021118, -1.4212923049926758, -1.4235053062438965, -1.425716519355774, -1.427925944328308, -1.430133581161499, -1.4323395490646362, -1.4345438480377197, -1.43674635887146]} diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py index 9980fa2f39be..ea747ed819df 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/fixtures/python/runner.py @@ -72,6 +72,9 @@ def main(): x = np.linspace(0.75, 0.9999, 500, dtype=np.float32) gen(x, "large.json") + x = np.linspace(1.0, 3.0, 500, dtype=np.float32) + gen(x, "huge.json") + if __name__ == "__main__": main() diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js index 855b867eeac6..52d947153a2c 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js @@ -34,6 +34,7 @@ var spencef = require( './../lib' ); var small = require( './fixtures/python/small.json' ); var medium = require( './fixtures/python/medium.json' ); var large = require( './fixtures/python/large.json' ); +var huge = require( './fixtures/python/huge.json' ); // TESTS // @@ -104,6 +105,26 @@ tape( 'the function accurately computes the dilogarithm for large positive numbe t.end(); }); +tape( 'the function accurately computes the dilogarithm for huge positive numbers', function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = huge.x; + expected = huge.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + tol = 1.7 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + tape( 'the function returns `0.0` if provided `1.0` for `x`', function test( t ) { var val = spencef( 1.0 ); t.strictEqual( val, 0.0, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js index c44137a2bb39..ca6ee1de0e89 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js @@ -35,6 +35,7 @@ var tryRequire = require( '@stdlib/utils/try-require' ); var small = require( './fixtures/python/small.json' ); var medium = require( './fixtures/python/medium.json' ); var large = require( './fixtures/python/large.json' ); +var huge = require( './fixtures/python/huge.json' ); // VARIABLES // @@ -115,6 +116,28 @@ tape( 'the function accurately computes the dilogarithm for large positive numbe t.end(); }); +tape( 'the function accurately computes the dilogarithm for huge positive numbers', opts, function test( t ) { + var expected; + var delta; + var tol; + var x; + var v; + var i; + + x = huge.x; + expected = huge.expected; + + for ( i = 0; i < x.length; i++ ) { + v = spencef( x[ i ] ); + delta = absf( v - expected[ i ] ); + + // NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205 + tol = 7.0 * EPS * absf( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); + } + t.end(); +}); + tape( 'the function returns `0.0` if provided `1.0` for `x`', opts, function test( t ) { var val = spencef( 1.0 ); t.strictEqual( val, 0.0, 'returns expected value' ); From 48d185f506f04cf74840bc1cfa161df9ea9d4e33 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Tue, 20 May 2025 10:03:46 -0700 Subject: [PATCH 5/5] chore: use f32 instead of float64ToFloat32 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/spencef/lib/main.js | 21 +++++++++---------- .../math/base/special/spencef/test/test.js | 6 +++--- .../base/special/spencef/test/test.native.js | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js b/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js index c6ce786f53a1..01a9a20d3aa1 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/lib/main.js @@ -36,14 +36,14 @@ var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var lnf = require( '@stdlib/math/base/special/lnf' ); -var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); var polyvalA = require( './polyval_a.js' ); var polyvalB = require( './polyval_b.js' ); // VARIABLES // -var PI2O6 = float64ToFloat32( 1.64493406684822643647 ); // π^2 / 6 +var PI2O6 = f32( 1.64493406684822643647 ); // π^2 / 6 // MAIN // @@ -100,27 +100,26 @@ function spencef( x ) { } flg = 0; if ( x > 2.0 ) { - x = float64ToFloat32( 1.0 / float64ToFloat32( x ) ); + x = f32( 1.0 / f32( x ) ); flg |= 2; } if ( x > 1.5 ) { - w = float64ToFloat32( 1.0 / float64ToFloat32( x ) ) - 1.0; + w = f32( 1.0 / f32( x ) ) - 1.0; flg |= 2; } else if ( x < 0.5 ) { - w = float64ToFloat32( -x ); + w = f32( -x ); flg |= 1; } else { - w = float64ToFloat32( x ) - 1.0; + w = f32( x ) - 1.0; } - // eslint-disable-next-line max-len - y = float64ToFloat32( -w * float64ToFloat32( polyvalA( w )/polyvalB( w ) ) ); + + y = f32( -w * f32( f32( polyvalA(w) ) / f32( polyvalB(w) ) ) ); if ( flg & 1 ) { - // eslint-disable-next-line max-len - y = float64ToFloat32( PI2O6 - float64ToFloat32( lnf( x )*lnf( 1.0-x ) ) - y ); + y = f32( PI2O6 - f32( lnf( x )*lnf( 1.0-x ) ) - y ); } if ( flg & 2 ) { z = lnf( x ); - y = -float64ToFloat32( float64ToFloat32( 0.5*z*z ) + y ); + y = -f32( f32( 0.5*z*z ) + y ); } return y; } diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js index 52d947153a2c..ec9c6912a1bb 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.js @@ -24,7 +24,7 @@ var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var absf = require( '@stdlib/math/base/special/absf' ); var PI_SQUARED = require( '@stdlib/constants/float32/pi-squared' ); -var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); var EPS = require( '@stdlib/constants/float32/eps' ); var spencef = require( './../lib' ); @@ -99,7 +99,7 @@ tape( 'the function accurately computes the dilogarithm for large positive numbe for ( i = 0; i < x.length; i++ ) { v = spencef( x[ i ] ); delta = absf( v - expected[ i ] ); - tol = EPS * absf( expected[ i ] ); + tol = 2.0 * EPS * absf( expected[ i ] ); t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. actual: ' + v + '. expected: ' + expected[ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ); } t.end(); @@ -133,7 +133,7 @@ tape( 'the function returns `0.0` if provided `1.0` for `x`', function test( t ) tape( 'the function returns `PI^2/6` if provided `0.0` for `x`', function test( t ) { var val = spencef( 0.0 ); - t.strictEqual( val, float64ToFloat32( PI_SQUARED/6.0 ), 'returns expected value' ); + t.strictEqual( val, f32( PI_SQUARED/6.0 ), 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js index ca6ee1de0e89..84b447eba894 100644 --- a/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/spencef/test/test.native.js @@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var absf = require( '@stdlib/math/base/special/absf' ); -var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); var PI_SQUARED = require( '@stdlib/constants/float32/pi-squared' ); var EPS = require( '@stdlib/constants/float32/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -146,7 +146,7 @@ tape( 'the function returns `0.0` if provided `1.0` for `x`', opts, function tes tape( 'the function returns `PI^2/6` if provided `0.0` for `x`', opts, function test( t ) { var val = spencef( 0.0 ); - t.strictEqual( val, float64ToFloat32( PI_SQUARED/6.0 ), 'returns expected value' ); + t.strictEqual( val, f32( PI_SQUARED/6.0 ), 'returns expected value' ); t.end(); });