Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
💀 Math witchcraft.
💀 Math witchcraft.
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.
As all Coven Engineering libraries, it has 100% test coverage and it's built in top of modern tech compatible with all JavaScript runtimes.
Example
import { calculate } from "@coven/math"; calculate(0.1).add(0.2); // 0.3 🤯
Other links
Add Package
deno add jsr:@coven/math
Import symbol
import * as mod from "@coven/math";
---- OR ----
Import directly with a jsr specifier
import * as mod from "jsr:@coven/math";
Add Package
npx jsr add @coven/math
Import symbol
import * as mod from "@coven/math";
Add Package
yarn dlx jsr add @coven/math
Import symbol
import * as mod from "@coven/math";
Add Package
pnpm dlx jsr add @coven/math
Import symbol
import * as mod from "@coven/math";
Add Package
bunx jsr add @coven/math
Import symbol
import * as mod from "@coven/math";