What is the standard (or best supported) big number (arbitrary precision) library for Lua?

The lmapm library by Luiz Figueiredo, one of the authors of the Lua language.

I can't really answer, but I will add LGMP, a GMP binding. Not used. Not my field of expertise, but I would expect the GNU multiple precision arithmetic library to be quite a standard here, no?

Ah. That's helpful as the GMP documentation does not list it: gmplib. Org/manual/Language-Bindings.

Html#Language-Bindings – Jon Ericson Nov 13 '08 at 23:46.

Using lbc instead of lmapm would be easier because lbc is self-contained. Require"bc" s=bc. Pow(2,1000):tostring() z=0 for i=1,#s do z=z+s:byte(i)-("0"):byte(1) end print(z).

Wow! Mr. Figueiredo, welcome to the Stack Overflow! – Alexander Gladysh May 14 '09 at 22:53 Thanks.

Let's see how it goes and how much time I can find to come here. – lhf May 18 '09 at 12:51 I'm still getting used to stackoverflow. I guess this answer of mine would have been more adequate as a comment to Jon Ericson's answer, which currently is below my answer... – lhf May 20 '09 at 11:55.

Though not arbitrary precision, Lua decNumber, a Lua 5.1 wrapper for IBM decNumber, implements the proposed General Decimal Arithmetic standard IEEE 754r. It has the Lua 5.1 arithmetic operators and more, full control over rounding modes, and working precision up to 69 decimal digits.

That's about a third as many as I need. (I'm working on ;.) – Jon Ericson Nov 17 '08 at 22:58.

I used Norman Ramsey's suggestion to solve Project Euler problem #16. I don't think it's a spoiler to say that the crux of the problem is calculating a 303 digit integer accurately. Here are the steps I needed to install and use the library: Lua needs to be built with dynamic loading enabled.

I use Cygwin, but I changed PLAT in src/Makefile to be linux. The default, none, doesn't enable dynamic loading. The MAMP needs to be built and installed somewhere that your C compiler can find it.

I put libmapm. A in /usr/local/lib/. Next m_apm.

H and m_apm_lc. H went to /usr/local/include/. The makefile for lmamp needs to be altered to the correct location of the Lua and MAMP libraries.

For me, that means uncommenting the second declaration of LUA, LUAINC, LUALIB, and LUABIN and editing the declaration of MAMP. Finally, mapm. So needs to be placed somewhere that Lua will find it.

I put it at /usr/local/lib/lua/5.1/. Thank you all for the suggestions!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions