comp.lang.ada
 help / color / mirror / Atom feed
From: spiegel@bruessel.informatik.uni-stuttgart.de (Andre Spiegel)
Subject: Large Integers?
Date: Tue, 10 Jan 1995 10:56:02 GMT
Date: 1995-01-10T10:56:02+00:00	[thread overview]
Message-ID: <SPIEGEL.95Jan10115602@berlin.bruessel.informatik.uni-stuttgart.de> (raw)

I am writing a network monitor program in Ada. Since, among other
things, it counts the number of bytes flowing through the cable, I'll
sooner or later run into integer overflows (the number might well
exceed 2**31-1, which is the upper limit of Natural).

Thus, I'm looking for a package that implements large positive
integers. Range 0 .. 2**32-1 ("unsigned word") would not be enough, I'd
rather need at least range 0 .. 2**40. An "unsigned double word" 
(0 .. 2**64-1) would save me from overflows for a few thousand
years.

The package should simply define a new type, say "Large_Natural", and
provide operations to add, subtract, divide and multiply the values
(also with odinary "Naturals"), and I also want to be able to do I/O,
using procedures with profiles identical to Integer_IO.Put and Get.

I don't think this is too difficult to implement, it would probably
take me a day or two to do it myself, but this is unfortunately
more than I have at the moment. But I assume such a thing has already
been done by someone on the net. It is critical that the package
provides all the operations in the same fashion as Ada does for
ordinary integers, because it would also take me a day or two to
change my code accordingly. I want to simply "with" and "use" the
package, replace "Natural" by "Large_Natural" (or whatever), and 
that should be it. 

Has anyone written such a package? Forgive me for being so demanding,
it's just that I think I know precisely what I need.

Thanks for any help.

Regards,

--
Andre Spiegel                     |  This life is a test. It is only a test.
                                  |  Had this been an actual life, you would
University of Stuttgart, Germany  |  have received further instructions as to
Computer Science                  |  where to go and what to do.
                                                            -- Author unknown

	   e-mail: spiegel@bruessel.informatik.uni-stuttgart.de




             reply	other threads:[~1995-01-10 10:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-10 10:56 Andre Spiegel [this message]
1995-01-10 19:47 ` Large Integers? Ken Anderson
1995-01-10 20:45 ` Charles H. Sampson
1995-01-11  2:39   ` Robert Dewar
     [not found] ` <EACHUS.95Jan11095036@spectre.mitre.org>
1995-01-13 15:56   ` Andre Spiegel
     [not found] ` <SPIEGEL.95Jan11111040@berlin.bruessel.informatik.uni-stuttgart.de>
     [not found]   ` <3fhjr1$4h8@rational.rational.com>
1995-01-18 23:22     ` Robert Dewar
replies disabled

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