@plato/pmath
v0.4.1
Published
Plato math functions, based on FDLIBM
Downloads
104
Maintainers
Keywords
Readme
@plato/pmath
Plato math functions, based on FDLIBM.
This package is a Node.js Addon and is compiled from source during package install for the target platform and current version of Node.js.
NOTE: Consider using node-pre-gyp
to build/host prebuilt binaries instead.
Usage
Install via Yarn:
yarn add @plato/pmath
Import the package and invoke exported math functions:
import { atan2, cos, sin } from "@plato/pmath";
const n = cos(10);
console.log(`cos(10) = ${n}`);
Development
Install & Update
When pulling updates or initially cloning this repo, make sure to update the submodules by running:
git submodule update --init
Afterwards, simply installing Yarn dependencies will build the native addon (the build scripts are triggered during package install). Run:
yarn
Build
The build steps can be invoked manually as well:
To manually build FDLIBM, run:
yarn build-fdlibm
To manually build the native Node.js addon (requires FDLIBM to have been built previously), run:
yarn build
Test
Execute unit tests (after the native addon is built) by running:
yarn test