From 29c33d4f6bbc5c9d9ef47114b5671fae41bc8bc5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 01:58:39 +0000 Subject: [PATCH] Auto-generated commit --- .github/.keepalive | 1 + README.md | 22 ++++++++--------- branches.md | 11 +++++---- dist/index.js | 36 ++++++++++++++++++++++++---- dist/main.js | 58 ++++++++++++++++++++++++++++++++++++++++++++ dist/native.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 168 insertions(+), 20 deletions(-) create mode 100644 .github/.keepalive create mode 100644 dist/main.js create mode 100644 dist/native.js diff --git a/.github/.keepalive b/.github/.keepalive new file mode 100644 index 0000000..b565dd8 --- /dev/null +++ b/.github/.keepalive @@ -0,0 +1 @@ +2024-02-01T01:58:37.559Z diff --git a/README.md b/README.md index 95eed9b..8d307c4 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,14 @@ npm install @stdlib/number-float64-base-assert-is-same-value-zero Alternatively, -- To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm` branch][esm-url]. -- If you are using Deno, visit the [`deno` branch][deno-url]. -- For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd` branch][umd-url]. +- To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). +- If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). +- For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships. +To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above. +
@@ -266,11 +268,6 @@ For more information on the project, filing bug reports and feature requests, an --- -## License - -See [LICENSE][stdlib-license]. - - ## Copyright Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. @@ -286,8 +283,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/number-float64-base-assert-is-same-value-zero.svg [npm-url]: https://npmjs.org/package/@stdlib/number-float64-base-assert-is-same-value-zero -[test-image]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/actions/workflows/test.yml/badge.svg?branch=v0.1.0 -[test-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/actions/workflows/test.yml?query=branch:v0.1.0 +[test-image]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/actions/workflows/test.yml/badge.svg?branch=main +[test-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/actions/workflows/test.yml?query=branch:main [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float64-base-assert-is-same-value-zero/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/number-float64-base-assert-is-same-value-zero?branch=main @@ -310,12 +307,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules [deno-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/deno +[deno-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/deno/README.md [umd-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/umd +[umd-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/umd/README.md [esm-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/esm +[esm-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/esm/README.md [branches-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/main/branches.md -[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/number-float64-base-assert-is-same-value-zero/main/LICENSE - [@stdlib/number/float64/base/assert/is-same-value]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value
diff --git a/branches.md b/branches.md index d7eb8ad..bb1467d 100644 --- a/branches.md +++ b/branches.md @@ -24,9 +24,9 @@ This repository has the following branches: - **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. - **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. +- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). +- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). +- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). The following diagram illustrates the relationships among the above branches: @@ -49,5 +49,8 @@ C -->|bundle| F[umd]; [stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/float64/base/assert/is-same-value-zero [production-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/production [deno-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/deno +[deno-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/deno/README.md [umd-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/umd -[esm-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/esm \ No newline at end of file +[umd-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/umd/README.md +[esm-url]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/tree/esm +[esm-readme]: https://github.com/stdlib-js/number-float64-base-assert-is-same-value-zero/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 084fed6..d48d1ca 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,33 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var s=i(function(c,t){ -function u(r,e){return r===e||r!==r&&e!==e}t.exports=u -});var n=s();module.exports=n; /** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map + +'use strict'; + +/** +* Test if two double-precision floating-point numbers are the same value. +* +* @module @stdlib/number-float64-base-assert-is-same-value-zero +* +* @example +* var isSameValueZero = require( '@stdlib/number-float64-base-assert-is-same-value-zero' ); +* +* var bool = isSameValueZero( 3.14, 3.14 ); +* // returns true +* +* bool = isSameValueZero( -0.0, -0.0 ); +* // returns true +* +* bool = isSameValueZero( -0.0, 0.0 ); +* // returns true +* +* bool = isSameValueZero( NaN, NaN ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/dist/main.js b/dist/main.js new file mode 100644 index 0000000..7032ac6 --- /dev/null +++ b/dist/main.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'; + +// MAIN // + +/** +* Tests if two double-precision floating-point numbers are the same value. +* +* ## Notes +* +* - The function implements the SameValueZero Algorithm used by `TypedArray` and `ArrayBuffer` constructors, `Map` and `Set` operations, `String.prototype.includes`, and `Array.prototype.includes` since ES2016. +* - In contrast to the strict equality operator `===`, `NaNs` are considered the same value. +* +* @param {number} a - first input value +* @param {number} b - second input value +* @returns {boolean} boolean indicating whether two double-precision floating-point numbers are the same value +* +* @example +* var bool = isSameValueZero( 3.14, 3.14 ); +* // returns true +* +* @example +* var bool = isSameValueZero( -0.0, -0.0 ); +* // returns true +* +* @example +* var bool = isSameValueZero( -0.0, 0.0 ); +* // returns true +* +* @example +* var bool = isSameValueZero( NaN, NaN ); +* // returns true +*/ +function isSameValueZero( a, b ) { + return ( a === b ) || ( a !== a && b !== b ); // handles NaNs +} + + +// EXPORTS // + +module.exports = isSameValueZero; diff --git a/dist/native.js b/dist/native.js new file mode 100644 index 0000000..50abe2c --- /dev/null +++ b/dist/native.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var Boolean = require( '@stdlib/boolean-ctor' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Tests if two double-precision floating-point numbers are the same value. +* +* @private +* @param {number} a - first input value +* @param {number} b - second input value +* @returns {boolean} boolean indicating whether two double-precision floating-point numbers are the same value +* +* @example +* var bool = isSameValueZero( 3.14, 3.14 ); +* // returns true +* +* @example +* var bool = isSameValueZero( -0.0, -0.0 ); +* // returns true +* +* @example +* var bool = isSameValueZero( -0.0, 0.0 ); +* // returns true +* +* @example +* var bool = isSameValueZero( NaN, NaN ); +* // returns true +*/ +function isSameValueZero( a, b ) { + return Boolean( addon( a, b ) ); +} + + +// EXPORTS // + +module.exports = isSameValueZero;