Skip to main content
Home

@coven/math@0.6.0
Built and signed on GitHub Actions

🧮 Precise math utilities.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a month ago (0.6.0)
Coven Engineering Math logo

JSR JSR Score

🧮 Precise math utilities.

Using this library, adding 0.2 + 0.1 will result in 0.3, and that might look like nothing to the untrained eye, but it's not what JavaScript usually does.

The way we achieve this is by using a tuple we called Precise which contains a representation of the base and exponent of a number using bigint. We then do all math operations over base and exponent in those tuples and turn them back to number when we are done.

Like all Coven Engineering libraries, it has 100% test coverage and it's built in top of modern tech compatible with all JavaScript runtimes.

Note

Obviously, using this or any library like it is way more expensive than doing a simple math operation, so use this only when a precise value is required. If speed is more important than precision, avoid this or any library like it.

Example

import { calculate } from "@coven/math";

calculate(0.1).plus(0.2).total; // 0.3 🤯
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@coven/math

Import symbol

import * as math from "@coven/math";
or

Import directly with a jsr specifier

import * as math from "jsr:@coven/math";

Add Package

pnpm i jsr:@coven/math
or (using pnpm 10.8 or older)
pnpm dlx jsr add @coven/math

Import symbol

import * as math from "@coven/math";

Add Package

yarn add jsr:@coven/math
or (using Yarn 4.8 or older)
yarn dlx jsr add @coven/math

Import symbol

import * as math from "@coven/math";

Add Package

vlt install jsr:@coven/math

Import symbol

import * as math from "@coven/math";

Add Package

npx jsr add @coven/math

Import symbol

import * as math from "@coven/math";

Add Package

bunx jsr add @coven/math

Import symbol

import * as math from "@coven/math";