Socket
Socket
Sign inDemoInstall

@thi.ng/math

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/math - npm Package Compare versions

Comparing version 5.7.12 to 5.8.0

22

abs.d.ts
import type { FnN2 } from "@thi.ng/api";
/**
* Returns the absolute difference between `a` and `b`.
*
* @param a
* @param b
*/
export declare const absDiff: FnN2;
/**
* Similar to `Math.sign()`, but uses `eps` to determine the zero value (i.e. if
* `x` is in [-eps,eps] interval).
*
* @param x
* @param eps
*/
export declare const sign: (x: number, eps?: number) => 0 | 1 | -1;
/**
* Raises `x` to `k` power and multiplies it with the {@link sign} of `x`, using
* `eps` to determine zero.
*
* @param x
* @param k
* @param eps
*/
export declare const signedPow: (x: number, k: number, eps?: number) => number;
//# sourceMappingURL=abs.d.ts.map

6

abs.js
import { EPS } from "./api.js";
const absDiff = (x, y) => Math.abs(x - y);
const absDiff = (a, b) => Math.abs(a - b);
const sign = (x, eps = EPS) => x > eps ? 1 : x < -eps ? -1 : 0;
const signedPow = (x, k, eps = EPS) => sign(x, eps) * Math.abs(x) ** k;
export {
absDiff,
sign
sign,
signedPow
};
# Change Log
- **Last updated**: 2024-01-23T15:58:27Z
- **Last updated**: 2024-01-26T18:03:04Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,8 @@

## [5.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.8.0) (2024-01-26)
#### 🚀 Features
- add signedPow(), add docs ([5207ba3](https://github.com/thi-ng/umbrella/commit/5207ba3))
### [5.7.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.7.2) (2023-11-09)

@@ -14,0 +20,0 @@

{
"name": "@thi.ng/math",
"version": "5.7.12",
"version": "5.8.0",
"description": "Assorted common math functions & utilities",

@@ -41,3 +41,3 @@ "type": "module",

"dependencies": {
"@thi.ng/api": "^8.9.17"
"@thi.ng/api": "^8.9.18"
},

@@ -142,3 +142,3 @@ "devDependencies": {

},
"gitHead": "417b5a7ea7bd54a3b4f086fe0fc2ce8e8933c9b2\n"
"gitHead": "7426e2ae6fca5482c6eaf649872296fc89955374\n"
}

@@ -71,3 +71,3 @@ <!-- This file is generated - DO NOT EDIT! -->

Package sizes (brotli'd, pre-treeshake): ESM: 4.07 KB
Package sizes (brotli'd, pre-treeshake): ESM: 4.09 KB

@@ -74,0 +74,0 @@ ## Dependencies

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc