comp.lang.ada
 help / color / mirror / Atom feed
* bignums
@ 2001-07-24  0:28 Tomasz Wegrzanowski
  2001-07-24  6:36 ` bignums Gerhard Häring
  2001-07-24 15:22 ` bignums Ehud Lamm
  0 siblings, 2 replies; 6+ messages in thread
From: Tomasz Wegrzanowski @ 2001-07-24  0:28 UTC (permalink / raw)


Is there any unlimited-size-integer thing in Ada,
something like gmp in C ?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bignums
  2001-07-24  0:28 bignums Tomasz Wegrzanowski
@ 2001-07-24  6:36 ` Gerhard Häring
  2001-07-24 15:22 ` bignums Ehud Lamm
  1 sibling, 0 replies; 6+ messages in thread
From: Gerhard Häring @ 2001-07-24  6:36 UTC (permalink / raw)


Tomasz Wegrzanowski wrote:
> 
> Is there any unlimited-size-integer thing in Ada,
> something like gmp in C ?

Never actually tried this, but here's an URL: http://www.chez.com/bignumber/

Gerhard
--
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://highqualdev.com              public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bignums
  2001-07-24  0:28 bignums Tomasz Wegrzanowski
  2001-07-24  6:36 ` bignums Gerhard Häring
@ 2001-07-24 15:22 ` Ehud Lamm
  2001-07-24 17:51   ` bignums Gisle Sælensminde
  1 sibling, 1 reply; 6+ messages in thread
From: Ehud Lamm @ 2001-07-24 15:22 UTC (permalink / raw)


Tomasz Wegrzanowski <taw@pb220.legnica.sdi.tpnet.pl> wrote in message
news:9jifep$kf0$2@news.tpi.pl...
> Is there any unlimited-size-integer thing in Ada,
> something like gmp in C ?

There are two issues here. First, support for bignums: there are some
package around, and it isn't too hard to hack something.
The second issue is efficiency. I seem to recall that GMP is highly
optimized, uses assembly language etc. So one  may actually want or hope for
a binding to GMP. I don't know a thing about it, but I did find this web
page http://www.chiark.greenend.org.uk/~mroe/Ada/GMP/. Maybe someone knows
more about the current status of this.


HTH

Ehud Lamm





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bignums
  2001-07-24 15:22 ` bignums Ehud Lamm
@ 2001-07-24 17:51   ` Gisle Sælensminde
  2001-07-24 17:59     ` bignums Ehud Lamm
  0 siblings, 1 reply; 6+ messages in thread
From: Gisle Sælensminde @ 2001-07-24 17:51 UTC (permalink / raw)


In article <9jk3th$knr$1@news.huji.ac.il>, Ehud Lamm wrote:
>Tomasz Wegrzanowski <taw@pb220.legnica.sdi.tpnet.pl> wrote in message
>news:9jifep$kf0$2@news.tpi.pl...
>> Is there any unlimited-size-integer thing in Ada,
>> something like gmp in C ?
>
>There are two issues here. First, support for bignums: there are some
>package around, and it isn't too hard to hack something.
>The second issue is efficiency. I seem to recall that GMP is highly
>optimized, uses assembly language etc. So one  may actually want or hope for
>a binding to GMP. I don't know a thing about it, but I did find this web
>page http://www.chiark.greenend.org.uk/~mroe/Ada/GMP/. Maybe someone knows
>more about the current status of this.

I also wrote a binding for GMP, and have finished the integer part of it,
including a thick binding, but not for rationals and floats. I had plans 
to develop the rest when I have made the thick binding for floats as 
well, but the project stop since I personally only needed integers, and 
the float stuff seems to be crap, so I stoped there without finishing the 
project. I if anybody are interested I can put the bits together and 
relese it.

There is one problem by making a thick binding for a library like GMP.
Of cause the most natural way of making a thick binding is to use
operator overloading, so that you can make code like "A = B + C;".

The problem is that each new GMP number is dynamically allocated,
and for uing it with operator overloading you must make a controlled 
type and allocate a new new number for each operation. This leads to
very slow code, compared to the thin binding. In my fibonacci test
there were a 1:6 difference between them.

A better Idea then would be to write a new binding where one could use
Ada's capability to allocate the numbers on the stack. I was member of a 
mailing list where we started looking at this, but it ended because 
all of us were having (final) exams at the time.

- Gisle

>
>
>HTH
>
>Ehud Lamm
>
>


-- 
--
Gisle S�lensminde ( gisle@ii.uib.no )   

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead. (from RFC 1925)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bignums
  2001-07-24 17:51   ` bignums Gisle Sælensminde
@ 2001-07-24 17:59     ` Ehud Lamm
  0 siblings, 0 replies; 6+ messages in thread
From: Ehud Lamm @ 2001-07-24 17:59 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

Gisle S�lensminde <gisle@apal.ii.uib.no> wrote in message
news:slrn9lrdd8.t30.gisle@apal.ii.uib.no...
>
> I also wrote a binding for GMP, and have finished the integer part of it,
> including a thick binding, but not for rationals and floats. I had plans
> to develop the rest when I have made the thick binding for floats as
> well, but the project stop since I personally only needed integers, and
> the float stuff seems to be crap, so I stoped there without finishing the
> project. I if anybody are interested I can put the bits together and
> relese it.
>
>
> The problem is that each new GMP number is dynamically allocated,
> and for uing it with operator overloading you must make a controlled
> type and allocate a new new number for each operation. This leads to
> very slow code, compared to the thin binding. In my fibonacci test
> there were a 1:6 difference between them.
>


Still seems to me worth publishing it somewhere (adapower, I guess). I'd
post a fast version, not using controlled types - since I assume most users
of such things worry mostly about speed. But then, I guess they also run out
of memory sometimes...

Ehud Lamm





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bignums
@ 2001-07-24 20:16 Gautier Write-only-address
  0 siblings, 0 replies; 6+ messages in thread
From: Gautier Write-only-address @ 2001-07-24 20:16 UTC (permalink / raw)
  To: comp.lang.ada

Gisle:
>A better Idea then would be to write a new binding where one
>could use Ada's capability to allocate the numbers on the stack.
>I was member of a mailing list where we started looking at this,
>but it ended because all of us were having (final) exams at the time.

Exact, he-he... Meanwhile I advertise for my multi-precision pack
(on BigNum page) that fully uses this Ada feature, since there
is absolutely no allocation in the library - of course one
can allocate multi-int variables for using them...
___________________________________________________
Gautier  --  http://www.diax.ch/users/gdm/gsoft.htm

NB: Do not answer to sender address, visit the Web site!
    Ne r�pondez pas � l'exp�diteur, visitez le site ouaibe!



>From: gisle@apal.ii.uib.no (Gisle S�lensminde)
>Reply-To: comp.lang.ada@ada.eu.org
>To: comp.lang.ada@ada.eu.org
>Subject: Re: bignums
>Date: 24 Jul 2001 17:51:36 GMT
>
>In article <9jk3th$knr$1@news.huji.ac.il>, Ehud Lamm wrote:
> >Tomasz Wegrzanowski <taw@pb220.legnica.sdi.tpnet.pl> wrote in message
> >news:9jifep$kf0$2@news.tpi.pl...
> >> Is there any unlimited-size-integer thing in Ada,
> >> something like gmp in C ?
> >
> >There are two issues here. First, support for bignums: there are some
> >package around, and it isn't too hard to hack something.
> >The second issue is efficiency. I seem to recall that GMP is highly
> >optimized, uses assembly language etc. So one  may actually want or hope 
>for
> >a binding to GMP. I don't know a thing about it, but I did find this web
> >page http://www.chiark.greenend.org.uk/~mroe/Ada/GMP/. Maybe someone 
>knows
> >more about the current status of this.
>
>I also wrote a binding for GMP, and have finished the integer part of it,
>including a thick binding, but not for rationals and floats. I had plans
>to develop the rest when I have made the thick binding for floats as
>well, but the project stop since I personally only needed integers, and
>the float stuff seems to be crap, so I stoped there without finishing the
>project. I if anybody are interested I can put the bits together and
>relese it.
>
>There is one problem by making a thick binding for a library like GMP.
>Of cause the most natural way of making a thick binding is to use
>operator overloading, so that you can make code like "A = B + C;".
>
>The problem is that each new GMP number is dynamically allocated,
>and for uing it with operator overloading you must make a controlled
>type and allocate a new new number for each operation. This leads to
>very slow code, compared to the thin binding. In my fibonacci test
>there were a 1:6 difference between them.
>
>A better Idea then would be to write a new binding where one could use
>Ada's capability to allocate the numbers on the stack. I was member of a
>mailing list where we started looking at this, but it ended because
>all of us were having (final) exams at the time.
>
>- Gisle
>
> >
> >
> >HTH
> >
> >Ehud Lamm
> >
> >
>
>
>--
>--
>Gisle S�lensminde ( gisle@ii.uib.no )
>
>With sufficient thrust, pigs fly just fine. However, this is not
>necessarily a good idea. It is hard to be sure where they are going
>to land, and it could be dangerous sitting under them as they fly
>overhead. (from RFC 1925)
>_______________________________________________
>comp.lang.ada mailing list
>comp.lang.ada@ada.eu.org
>http://ada.eu.org/mailman/listinfo/comp.lang.ada


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-07-24 20:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-24  0:28 bignums Tomasz Wegrzanowski
2001-07-24  6:36 ` bignums Gerhard Häring
2001-07-24 15:22 ` bignums Ehud Lamm
2001-07-24 17:51   ` bignums Gisle Sælensminde
2001-07-24 17:59     ` bignums Ehud Lamm
  -- strict thread matches above, loose matches on Subject: below --
2001-07-24 20:16 bignums Gautier Write-only-address

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox