For Programmers: Free Programming Magazines  


Home > Archive > Prolog > February 2006 > Bignum for Prolog?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bignum for Prolog?
Musashi

2006-02-01, 7:03 pm

I need a really fast bignum routine
particularly additons and multiplications
for Prolog, preferably SWI.

Before I ogle google or write
one myself, does anyone have
any favorite bignum predicate links
to mention?

Many thanks.
Mu


Markus Triska

2006-02-01, 7:03 pm

Hi!

Musashi wrote:
> I need a really fast bignum routine
> particularly additons and multiplications
> for Prolog, preferably SWI.


SWI Prolog has transparent built-in support for arbitrary precision
integers:

?- X is 10^70 * 12.

X = 1200000000000000000000000000000000000000
00000000000000000000000000000000


All the best,
Markus.
Jan Wielemaker

2006-02-01, 7:03 pm

On 2006-02-01, Markus Triska <triska@gmx.at> wrote:
> Hi!
>
> Musashi wrote:
>
> SWI Prolog has transparent built-in support for arbitrary precision
> integers:
>
> ?- X is 10^70 * 12.
>
> X = 1200000000000000000000000000000000000000
00000000000000000000000000000000


.... Only the late 5.5.x development versions and the 5.6.x stable versions :-)
If you compile from the source, make sure you have libgmp installed!

The GNU gmp library is supposed to be very fast. There is a bit of overhead
if you call it from Prolog in copying the bignums from/to the Prolog stacks.
Still, there are people doing serious number-crunching with it.

Cheers --- Jan


Markus Triska

2006-02-01, 7:03 pm

Hi Jan!

Jan Wielemaker wrote:

> ... Only the late 5.5.x development versions and the 5.6.x stable versions :-)


I hope to see this feature also in future versions :-).

All the best,
Markus.
Musashi

2006-02-01, 7:03 pm


"Markus Triska" <triska@gmx.at> wrote in message
news:43e10602$0$8024$3b214f66@tunews.univie.ac.at...
> Hi!
>
> Musashi wrote:
>
> SWI Prolog has transparent built-in support for arbitrary precision
> integers:
>
> ?- X is 10^70 * 12.
>
> X =
> 1200000000000000000000000000000000000000
00000000000000000000000000000000
>
>
> All the best,
> Markus.



Wow!

Looks like I'll be getting SWI 5.6.x

Many thanks.
Musashi


Mats

2006-02-02, 3:57 am


Musashi wrote:
> I need a really fast bignum routine
> particularly additons and multiplications
> for Prolog, preferably SWI.
>
> Before I ogle google or write
> one myself, does anyone have
> any favorite bignum predicate links
> to mention?


SICStus Prolog has unbounded precision integer arithmetics:

| ?- X is 1<<100, Y is 23459873459872*9595992123487659001.
X = 1267650600228229401496703205376,
Y = 225120760938948887043283593107872

--Mats

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com