From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,17e9efb0492e0d7b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-10 02:56:02 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!news.bu.edu!bloom-beacon.mit.edu!spool.mu.edu!uwm.edu!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!scsing.switch.ch!news.dfn.de!news.belwue.de!news.informatik.uni-stuttgart.de!spiegel From: spiegel@bruessel.informatik.uni-stuttgart.de (Andre Spiegel) Subject: Large Integers? Message-ID: Sender: news@informatik.uni-stuttgart.de Organization: University of Stuttgart, Germany Date: Tue, 10 Jan 1995 10:56:02 GMT Date: 1995-01-10T10:56:02+00:00 List-Id: 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