comp.lang.ada
 help / color / mirror / Atom feed
* Large Integers?
@ 1995-01-10 10:56 Andre Spiegel
  1995-01-10 19:47 ` Ken Anderson
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andre Spiegel @ 1995-01-10 10:56 UTC (permalink / 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




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

end of thread, other threads:[~1995-01-18 23:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-01-10 10:56 Large Integers? Andre Spiegel
1995-01-10 19:47 ` 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

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