Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 634 Bytes

File metadata and controls

19 lines (13 loc) · 634 Bytes

Parse Decimal

This library provides a simple parseDecimal function that parses the given numerical input (number, bigint, string) into a DecimalDefinition object that describes the given number.

It can be used as a building block for serializing decimal numbers into a binary format (e.g. ieee754) or to perform arbitrary precision arithmetic.

Usage

You can simply parse any number as follows

import { parseDecimal } from "https://deno.land/x/parse_decimal/mod.ts";

const definition = parseDecimal("1.423e422");
// { nan: false, finite: false, negative: false, significand: 1432n, exponent: 419n }