jqnpm / jq-bigint

A big integer library for working with possibly-signed arbitrarily long decimal strings.

Home Page:https://joelpurra.com/projects/jq-bigint/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jqnpm logotype, a Penrose triangle

A big integer library for working with possibly-signed arbitrarily long decimal strings. Written by Peter Koppstein (@pkoppstein) and released under the MIT license.

⚠️ This project has been archived

No future updates are planned. Feel free to continue using it, but expect no support.

This is a package for the command-line JSON processor jq. Install the package in your jq project/package directory with jqnpm:

jqnpm install joelpurra/jq-bigint

Usage

import "joelpurra/jq-bigint" as BigInt;

# BigInt::negate:                # . * -1
# BigInt::lessOrEqual(x; y):     # x <= y
# BigInt::long_add(x;y):         # x+y
# BigInt::long_minus(x;y):       # x-y
# BigInt::long_power(i):         # .^i
# BigInt::long_multiply(x;y):    # x*y
# BigInt::long_divide(x;y):      # x/y => [q,r]
# BigInt::long_div(x;y):         # integer division
# BigInt::long_mod(x;y):         # %

# In all cases, x and y must be strings; . and i should be an integer or a string.

License

Copyright (c) 2014, 2015 Peter Koppstein https://github.com/pkoppstein and Joel Purra https://joelpurra.com/ All rights reserved.

When using jq-bigint, comply to the MIT license. Please see the LICENSE file for details.

About

A big integer library for working with possibly-signed arbitrarily long decimal strings.

https://joelpurra.com/projects/jq-bigint/

License:Other


Languages

Language:jq 77.5%Language:Shell 22.5%