cmath-js 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -10
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
Implementations of some of C's math functions in TypeScript/JavaScript.
|
|
3
3
|
|
|
4
4
|
## Floating-point functions
|
|
5
|
-
- copysign
|
|
6
|
-
- fabs
|
|
7
|
-
- frexp
|
|
8
|
-
- hypot
|
|
9
|
-
- ldexp
|
|
10
|
-
- nextafter
|
|
11
|
-
- pow
|
|
12
|
-
- signbit
|
|
5
|
+
- [`copysign`](https://en.cppreference.com/w/c/numeric/math/copysign)
|
|
6
|
+
- [`fabs`](https://en.cppreference.com/w/c/numeric/math/fabs)
|
|
7
|
+
- [`frexp`](http://en.cppreference.com/w/c/numeric/math/frexp)
|
|
8
|
+
- [`hypot`](https://en.cppreference.com/w/cpp/numeric/math/hypot)¹
|
|
9
|
+
- [`ldexp`](https://en.cppreference.com/w/c/numeric/math/ldexp)
|
|
10
|
+
- [`nextafter`](https://en.cppreference.com/w/c/numeric/math/nextafter)
|
|
11
|
+
- [`pow`](https://en.cppreference.com/w/c/numeric/math/pow)
|
|
12
|
+
- [`signbit`](https://en.cppreference.com/w/c/numeric/math/signbit)
|
|
13
|
+
|
|
14
|
+
### Notes
|
|
15
|
+
1: `hypot` is the C++ version which works just like the C version but accepts an optional third value.
|
|
13
16
|
|
|
14
17
|
## Integer functions
|
|
15
|
-
|
|
16
|
-
- abs
|
|
18
|
+
This function accepts either a `number` or a `bigint`:
|
|
19
|
+
- [`abs`](https://en.cppreference.com/w/c/numeric/math/abs)
|
|
20
|
+
|
|
21
|
+
## Test coverage
|
|
22
|
+
The test coverage is a perfect 100% and enforced by the publishing and pull request verification workflows.
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contributions are welcomed! Feel free to make a pull request. Please add your name to `contributors` in `package.json` and run `npm run build-and-verify` before submitting your PR. By making a pull request you agree to license your contribution under [the CC0 license](https://creativecommons.org/publicdomain/zero/1.0/legalcode.en#legal-code-title) unless otherwise specified.
|
|
26
|
+
|
|
27
|
+
ESLint is used to enforce code quality and consistent formatting (with the help of Prettier). If ESLint complains when you run `npm run build-and-verify`, you can run `npm run lint-fix` to apply automatic fixes and and then fix the rest of the errors manually. I recommend configuring your IDE for ESLint and Prettier. If you are using Visual Studio Code, simply installing [Microsoft's ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [the official Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) takes care of that.
|
package/package.json
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/oskarlh/cmath-js.git"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.9",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"author": "Oskar Larsson Högfeldt <oskar@oskar.pm>",
|
|
13
|
+
"contributors": [
|
|
14
|
+
"Oskar Larsson Högfeldt <oskar@oskar.pm>"
|
|
15
|
+
],
|
|
13
16
|
"license": "MIT",
|
|
14
17
|
"description": "C's math functions implemented in TypeScript/JavaScript",
|
|
15
18
|
"keywords": [
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
"build-and-verify": "npm run test-with-typechecking --ci && npm run lint && npm run build",
|
|
48
51
|
"build-without-typechecking": "swc -C exclude=.test.ts -d dist -s true -- src",
|
|
49
52
|
"lint": "eslint .",
|
|
53
|
+
"lint-fix": "eslint . --fix",
|
|
50
54
|
"prepack": "npm run build",
|
|
51
55
|
"test": "jest",
|
|
52
56
|
"test-with-typechecking": "jest --config=jest.config.with-typechecking.js"
|