Skip to content

numstring is a full-featured Lua library for arbitrary-precision math using strings. It supports massive numbers, exact decimal precision, and scientific notation (e.g., 1e100). Designed for projects where Lua’s native number limits are a bottleneck, numstring gives you the power of big math with pure Lua code — no dependencies, no C extensions.

License

Notifications You must be signed in to change notification settings

danoricm/numstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numstring

numstring is a pure Lua library that performs arbitrary precision math using string based numbers. It runs on Lua 5.1, 5.2 and 5.3 without any external C modules.

Features

  • Addition, subtraction, multiplication and division for big integers
  • Precise decimal arithmetic with scale support
  • Parsing and formatting of scientific notation numbers
  • Comparison helpers and formatting utilities

Installation

Using LuaRocks:

luarocks install numstring

Usage

local numstring = require('numstring')

local a = numstring.decimal.parse("123.45")
local b = numstring.decimal.parse("6.7")
local c = numstring.decimal.add(a, b)
print(numstring.decimal.tostring(c)) -- 130.15

See the files in the test/ directory for additional examples.

License

numstring is released under the MIT license.

About

numstring is a full-featured Lua library for arbitrary-precision math using strings. It supports massive numbers, exact decimal precision, and scientific notation (e.g., 1e100). Designed for projects where Lua’s native number limits are a bottleneck, numstring gives you the power of big math with pure Lua code — no dependencies, no C extensions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages