{"id":12914,"library":"browserify-bignum","title":"Browserify Bignum","description":"This library provides a JavaScript implementation of arbitrary-precision arithmetic, specifically designed to be compatible with Node.js's `node-bignum` API while being usable in browser environments via Browserify. It is based on `bignumber.js` by MikeMcl. The current stable version is 1.3.0-2, released approximately nine years ago. It differs from the original `node-bignum` by explicitly *omitting* several key methods, including `prime`, `toNumber`, bitwise operations (`and`, `or`, `xor`), modular inverse, random number generation, primality testing, root, shift operations, GCD, and Jacobi symbol. This makes it suitable only for specific use cases that do not require these advanced features, such as its original purpose for `node-srp`. Given its age and the explicit statement about unimplemented features, active development is not ongoing, and it targets older browserify workflows rather than modern ESM or bundler setups.","status":"abandoned","version":"1.3.0-2","language":"javascript","source_language":"en","source_url":"https://github.com/innoying/browserify-bignum","tags":["javascript","arbitrary","precision","arithmetic","big","number","decimal","float","biginteger"],"install":[{"cmd":"npm install browserify-bignum","lang":"bash","label":"npm"},{"cmd":"yarn add browserify-bignum","lang":"bash","label":"yarn"},{"cmd":"pnpm add browserify-bignum","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primarily designed for CommonJS (`require`) and Browserify. Does not provide native ESM exports.","wrong":"import { BigNumber } from 'browserify-bignum';","symbol":"BigNumber","correct":"const BigNumber = require('browserify-bignum');"},{"note":"The library typically uses the constructor as a function (e.g., `BigNumber('...')`) rather than `new BigNumber(...)`, consistent with its `node-bignum` inspiration.","wrong":"const n = new BigNumber('12345');","symbol":"BigNumber (instance)","correct":"const n = BigNumber('12345');"}],"quickstart":{"code":"const BigNumber = require('browserify-bignum');\n\n// Create a new BigNumber instance from a string\nconst a = BigNumber('987654321098765432109876543210');\nconst b = BigNumber('123456789012345678901234567890');\n\n// Perform some arithmetic operations\nconst sum = a.add(b);\nconst product = a.mul(b);\nconst quotient = a.div(BigNumber('3')); // Divide by BigNumber '3'\n\nconsole.log('BigNumber a:', a.toString());\nconsole.log('BigNumber b:', b.toString());\nconsole.log('Sum (a + b):', sum.toString());\nconsole.log('Product (a * b):', product.toString());\nconsole.log('Quotient (a / 3):', quotient.toString());\n\n// Example of comparison\nif (a.cmp(b) > 0) {\n  console.log('a is greater than b');\n}","lang":"javascript","description":"Demonstrates how to import the BigNumber constructor, create instances from strings, and perform basic arithmetic and comparison operations."},"warnings":[{"fix":"Review the list of unsupported methods in the README. If these methods are critical, consider using `bignumber.js` directly or a different modern arbitrary-precision library that supports them.","message":"Many methods available in the original `node-bignum` library are explicitly *not* implemented in `browserify-bignum`, including `prime`, `toNumber`, bitwise operations (`and`, `or`, `xor`), `invertm`, `rand`, `probPrime`, `root`, `shiftLeft`, `shiftRight`, `gcd`, and `jacobi`. Direct migration from `node-bignum` will result in runtime errors if these methods are used.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"For new projects, consider modern, actively maintained alternatives like `bignumber.js`, `decimal.js`, or native `BigInt` (if integer-only operations are sufficient).","message":"The package is effectively abandoned, with the last commit on its GitHub repository over nine years ago. It is not actively maintained, meaning bug fixes, security updates, or new features are highly unlikely.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your build setup correctly handles CommonJS modules if integrating into a modern frontend or backend project. For browsers, it's intended to be bundled via Browserify.","message":"This library is designed for the Browserify ecosystem. Using it directly in modern Node.js ESM projects or with contemporary bundlers (Webpack, Rollup, Vite) without proper CommonJS compatibility layers may lead to issues or require additional configuration.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Audit the source code and its (potentially transitive) dependencies for known vulnerabilities. Consider sandboxing or migrating to a more secure, maintained library.","message":"Due to its age and lack of maintenance, the library might have unaddressed security vulnerabilities or rely on outdated dependencies. Using it in production environments without thorough security review is not recommended.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Consult the `browserify-bignum` README for the list of unimplemented methods. If the functionality is required, migrate to `bignumber.js` or another library.","cause":"Attempting to use a method (`.prime()`, `.toNumber()`, `.and()`, etc.) that is present in `node-bignum` but explicitly omitted in `browserify-bignum`.","error":"TypeError: BigNumber.prime is not a function"},{"fix":"Ensure your browser-side code is bundled using Browserify. If using modern bundlers (Webpack/Rollup/Vite), confirm they are configured to correctly handle CommonJS modules.","cause":"Attempting to use `require('browserify-bignum')` directly in a browser environment without being processed by Browserify or another CommonJS-aware bundler.","error":"ReferenceError: require is not defined"},{"fix":"Install the package via npm: `npm install browserify-bignum`. Verify your module resolution settings if using a custom environment.","cause":"The package is not installed, or the module resolution path is incorrect in a CommonJS environment (e.g., Node.js).","error":"Error: Cannot find module 'browserify-bignum'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}