UNPKG

bigfloat.js

Version:

A library for arbitrary precision floating point arithmetic.

29 lines (28 loc) 1.3 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; exports.__esModule = true; exports.TWO = exports.ONE = exports.EPSILON = exports.set_precision = exports.PRECISION = exports.ZERO = exports.BIGINT_TEN_MILLION = exports.BIGINT_TEN = exports.BIGINT_ONE = exports.BIGINT_ZERO = void 0; var jsbi_1 = __importDefault(require("jsbi")); var constructors_js_1 = require("./constructors.js"); exports.BIGINT_ZERO = jsbi_1["default"].BigInt("0"); exports.BIGINT_ONE = jsbi_1["default"].BigInt("1"); exports.BIGINT_TEN = jsbi_1["default"].BigInt("10"); exports.BIGINT_TEN_MILLION = jsbi_1["default"].BigInt("10000000"); exports.ZERO = Object.create(null); exports.ZERO.coefficient = exports.BIGINT_ZERO; exports.ZERO.exponent = 0; Object.freeze(exports.ZERO); exports.PRECISION = -4; function set_precision(n) { n = Number(n); if (!Number.isInteger(n) || Number(n) >= 0) { throw Error("Only negative integers are allowed for precision."); } exports.PRECISION = n; } exports.set_precision = set_precision; exports.EPSILON = constructors_js_1.make("0.0000000000000000000000000000000000000000000000001"); exports.ONE = constructors_js_1.make("1"); exports.TWO = constructors_js_1.make("2");