Built-in, unlimited precision, big integer arithmetik

Started by Lutz, April 12, 2013, 08:33:59 AM

Previous topic - Next topic

Lutz

The next version of newLISP features built-in, unlimited precision, big integer arithmetik. As I am currently travelling, I cannot make a full development release until the second week of May. Anybody interested can find binaries for OSX and Windows here:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



Linux users would have to compile from the source package.



Details on how to use this new feature can be found here:



http://www.newlisp.org/downloads/development/inprogress/newlisp_manual.html#big_int">http://www.newlisp.org/downloads/develo ... ml#big_int">http://www.newlisp.org/downloads/development/inprogress/newlisp_manual.html#big_int

HPW

#1
Hello Lutz,



Great new option.


QuoteAnybody interested can find binaries for OSX and Windows here:


Any chance to post also a DLL binary?



Regards
Hans-Peter

johu

Hello, Lutz.



It's fine!



I have just stated http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=4307">The Euler Project in newLISP.



And I translated newLISP-manual to Japanese.

Then, I have some opinions.



line 1652-1653
QuoteIntegers are 64-bit numbers including the sign bit 8.9.7).  Valid integers

are numbers between -9,223,372,036,854,775,808 and
    ↓
QuoteIntegers are 64-bit numbers (including the sign bit, 32-bit before version 8.9.7).

Valid integers are numbers between -9,223,372,036,854,775,808 and
maybe.



line 5629-5632
Quote<tr>

<td><a href="#bigint">bigint</a></td>

<td>convert a number to big integer format</td>

</tr>
bitint is string operator? My mistake, sorry.(2013/4/14 added)



line 16607-16609
Quote<p>See also <a href="#letn">letn</a> for an incremental or nested form of

<tt>let</tt> and local for initializing to <tt>nil</tt>. See <a href="#local">local</a>

for automatic initialization of variables to <tt>nil</tt>.</p>
I have heared that local is deprecated and have been taken out of the documentation.

But, there is in this manual.

Which is right?

I am glad to see local there.



Thanks,

HPW

#3
Thanks for the DLL!
Hans-Peter

lotabout

#4
Thanks Lutz.



It's very nice to feel that the tool in hand becomes much more powerful.



Works all right under Linux for now.

cormullion

#5
Nice addition, Lutz. Out of interest, why did you decide to add big number support now?

Lutz

#6
My interest in big numbers came to life when doing the Euler project examples. Over the years people also have asked for big integer support again and again and working with the GMP GNU gmp.lsp module was a bit clumsy, because all numbers have to be delievered to the GMP library as strings and special operators be used. Having large integer support built into the language is much nicer.



Thanks to everybody for comments and manual corrections. The bigint function now also converts from strings, like its smaller sibling int. The binaries will be updated later, when I have acccess to OSX.



There is an interesting site at google about large numbers by Sbiis Saibian here:

https://sites.google.com/site/largenumbers/home">https://sites.google.com/site/largenumbers/home



the following words from the introduction:



While the venues large numbers can open up in your mind can be quite rewarding, be warned that it must by necessity end in human futility. For we can no more imagine the end of numbers than we could wait out eternity. An earnest study of large numbers will completely shift the way you think about infinity, and your mind shall be forever changed for it.

cormullion

#7
Interesting. I'm going to play with it soon... And there's some editing work required in various other places, too, which I might get round to some time.



(arithmetiC, by the way, not arithmetiK), although it look good with a K...

xytroxon

#8
Quote from: "cormullion"(arithmetiC, by the way, not arithmetiK), although it look good with a K...


Bist du wahnsinnig?

http://de.wikipedia.org/wiki/Arithmetik">http://de.wikipedia.org/wiki/Arithmetik



-- xytroxon  ;o)
\"Many computers can print only capital letters, so we shall not use lowercase letters.\"

-- Let\'s Talk Lisp (c) 1976

cormullion

#9
Quote from: "xytroxon"Bist du wahnsinnig?


Ja veilleicht, ein bißchen, aber für programmieren mit NeueLisp wir mussen alles Englisch sprachen.



(Sorry, Lutz, my German lessons are a distant memory...)

xytroxon

#10
Ditto...



Since the death of my 4 German speaking great grandparents nearly 50 years ago, sadly, our family retains very few German words in their daily vocabulary.



Lutz's amazing command of the American er. "English" language is almost flawless.



Almost ;o)



-- xytroxon
\"Many computers can print only capital letters, so we shall not use lowercase letters.\"

-- Let\'s Talk Lisp (c) 1976

Lutz

#11
Quotealmost flawless

"almost", that is why I always appreciate help on manual changes and additions :-)



Updated binaries with speedups on / and % and bigint working on strings too, are here:

http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



The OSX executable is made on 10.8 Intel Mountain Lion - cannot make PPC executables at the moment.

Lutz

#12
update of binary executables including osx ppc here:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/

rickyboy

#13
Excellent!



:)  http://www.youtube.com/watch?v=YKUOB8MN4Kc">http://www.youtube.com/watch?v=YKUOB8MN4Kc
(λx. x x) (λx. x x)

kosh

#14
hi.



Does bigint function allow non-numerical characters?


newLISP v.10.5.0 32-bit on Win32 IPv4/6 UTF-8 libffi, options: newlisp -h

> (bigint "HELLO")
264111L
> (bigint "")
(null)L
> (bigint "-L")
; segmentation fault


and, what value returns with a floating-point string?


> (int "3.14")
3
> (bigint "3.14")
2814L  ; expect 3L