Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
/ lbc Public archive

A simple arbitrary precision library for Lua, based on code from GNU bc

Notifications You must be signed in to change notification settings

LuaDist/lbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a big-number library for Lua 5.1. It is based on the arbitrary
precision library number.c written by Philip A. Nelson for GNU bc-1.06:
	http://www.gnu.org/software/bc/

To try the library, just edit Makefile to reflect your installation of Lua and
then run make. This will build the library and run a simple test. For detailed
installation instructions, see
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/install.html

There is no manual but the library is simple and intuitive; see the summary
below. Read also test.lua, which shows the library in action.

This code is hereby placed in the public domain, except number.c and number.h,
which are subject to GPL.

Please send comments, suggestions, and bug reports to [email protected] .

-------------------------------------------------------------------------------

bc library:
 __add(x,y) 	 __pow(x,y) 	 digits([n]) 	 mul(x,y) 	 sub(x,y) 
 __div(x,y) 	 __sub(x,y) 	 div(x,y) 	 neg(x) 	 tonumber(x) 
 __eq(x,y) 	 __tostring(x) 	 divmod(x,y) 	 number(x) 	 tostring(x) 
 __lt(x,y) 	 __unm(x) 	 isneg(x) 	 pow(x,y) 	 trunc(x,[n]) 
 __mod(x,y) 	 add(x,y) 	 iszero(x) 	 powmod(x,y,m) 	 version 
 __mul(x,y) 	 compare(x,y) 	 mod(x,y) 	 sqrt(x) 

-------------------------------------------------------------------------------

About

A simple arbitrary precision library for Lua, based on code from GNU bc

ttp://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbc

Resources

Stars

Watchers

Forks

Packages

No packages published