npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@obinexusmk2/hypernum

v0.1.0

Published

A high-precision mathematics library for large number operations with BigInt support, custom data structures, and comprehensive type safety

Readme

@obinexuscomputing/hypernum - Computing from the Heart

Logo

A comprehensive TypeScript/JavaScript library for handling large number operations with BigInt support.

Features

  • High-precision arithmetic operations
  • Bitwise operations
  • Special mathematical functions (factorial, GCD, LCM, etc.)
  • Advanced data structures for large number manipulation
  • Configurable precision and overflow handling
  • Type-safe implementation in TypeScript

Installation

npm install @obinexuscomputing/hypernum

Basic Usage

import { createHypernum } from '@obinexuscomputing/hypernum';

// Create a Hypernum instance with default configuration
const hypernum = createHypernum();

// Basic arithmetic operations
const sum = hypernum.add("12345678901234567890", "98765432109876543210");
const product = hypernum.multiply(2n, "1000000000000000000");

Configuration

You can configure Hypernum with various options:

const customHypernum = createHypernum({
  precision: 10,              // Decimal precision
  roundingMode: 'HALF_EVEN',  // Rounding strategy
  checkOverflow: true,        // Enable overflow checking
  maxSteps: 1000             // Maximum computation steps
});

Core Operations

Arithmetic

const hypernum = createHypernum();

// Addition
const sum = hypernum.add(a, b);

// Subtraction
const difference = hypernum.subtract(a, b);

// Multiplication
const product = hypernum.multiply(a, b);

// Division
const quotient = hypernum.divide(a, b);

// Modulo
const remainder = hypernum.mod(a, b);

Bitwise Operations

// Bitwise AND
const andResult = hypernum.and(x, y);

// Bitwise OR
const orResult = hypernum.or(x, y);

// Bitwise XOR
const xorResult = hypernum.xor(x, y);

// Bitwise NOT
const notResult = hypernum.not(x);

Power Operations

// Power
const powered = hypernum.power(base, exponent);

// Square root
const sqrt = hypernum.sqrt(value);

// Nth root
const root = hypernum.nthRoot(value, n);

Advanced Features

Data Structures

BigArray

A specialized array implementation for handling large numbers efficiently:

import { BigArray } from '@obinexuscomputing/hypernum';

const array = new BigArray<bigint>();
array.push(12345678901234567890n);
array.push(98765432109876543210n);

// Range queries
const max = array.queryRange(0, 1);

NumberTree

An AVL tree implementation optimized for large number operations:

import { NumberTree } from '@obinexuscomputing/hypernum';

const tree = new NumberTree();
tree.insert(12345678901234567890n);
tree.insert(98765432109876543210n);

// Tree operations
const found = tree.find(12345678901234567890n);
const values = tree.traverse('inOrder');

PowerTower

Handles power tower (tetration) computations:

import { PowerTower } from '@obinexuscomputing/hypernum';

const tower = new PowerTower();
tower.build(2n, 4); // Computes 2↑↑4
const result = tower.evaluate();

AckermannStructure

Computes and manages Ackermann function values:

import { AckermannStructure } from '@obinexuscomputing/hypernum';

const ackermann = new AckermannStructure();
const result = ackermann.computeAckermann(3, 2);

Special Functions

// Greatest Common Divisor
const gcd = hypernum.gcd(48n, 18n);

// Least Common Multiple
const lcm = hypernum.lcm(48n, 18n);

// Factorial
import { factorial } from '@obinexuscomputing/hypernum';
const fact = factorial(10n);

// Binomial coefficient
import { binomial } from '@obinexuscomputing/hypernum';
const combination = binomial(10n, 5n);

Number Format Conversions

import { 
  toBinary,
  toHexadecimal,
  toRoman,
  fromRoman
} from '@obinexuscomputing/hypernum';

// Convert to different bases
const binary = toBinary(123456789n);
const hex = toHexadecimal(123456789n);

// Roman numeral conversion
const roman = toRoman(3549);
const number = fromRoman("MMMDXLIX");

Error Handling

The library provides specific error types for different scenarios:

import {
  HypernumError,
  OverflowError,
  ValidationError
} from '@obinexuscomputing/hypernum';

try {
  const result = hypernum.power(2n, 1000n);
} catch (error) {
  if (error instanceof OverflowError) {
    console.error('Computation would overflow');
  } else if (error instanceof ValidationError) {
    console.error('Invalid input values');
  }
}

Performance Considerations

  • Use BigInt literals (with 'n' suffix) for direct number input
  • Enable overflow checking only when necessary
  • Configure precision based on actual requirements
  • Use appropriate data structures for your use case
  • Consider using the built-in caching mechanisms for repeated computations

Type Safety

The library is written in TypeScript and provides full type definitions:

import type { 
  HypernumConfig,
  NumericInput,
  OperationOptions
} from '@obinexuscomputing/hypernum';

// Type-safe configuration
const config: HypernumConfig = {
  precision: 10,
  checkOverflow: true
};

// Type-safe numeric input
const input: NumericInput = "12345678901234567890";

Environment Support

  • Node.js ≥ 16.0.0
  • Modern browsers with BigInt support
  • TypeScript ≥ 4.5.0

License

ISC License

For more information, visit the GitHub repository.