comp.lang.ada
 help / color / mirror / Atom feed
From: "Vincent P. Amiot" <godzilla@mozilla.com>
Subject: Re: Very big Integers
Date: 1999/05/04
Date: 1999-05-04T00:00:00+00:00	[thread overview]
Message-ID: <01be95c1$a27f21a0$3503af88@alesia> (raw)
In-Reply-To: Pine.GSO.4.10.9904231559080.7427-100000@tick.informatik.uni-stuttgart.de

Some 8 years ago I implemented an embryo of RSA that needed big numbers and
a "modular exponentiation" (you have to perform modulus op on the
exponentiation as you go to prevent you from having to deal with
untractably large numbers).

At the time I used limited private taht were bit arrays in little endian
configuration, so the INT was actually:

	type Int is array (0..Size-1) of Boolean;
	pragma Pack (Int);  

where Size could be a generic formal parameter or a constant.

Besides the 4 basic binary ops (+,-,*,/), the unary ops (+,-), the
comparisons, you will need another basic operation: the numeric litteral...

It can be elegantly provided as:

	function "+" (Left: String) return Int;

to be used as follows:

	X : Int := +"12345678901234567890";

(of course raise constraint error if somebody tries to feed in a string
that contains non-numerical chars...)

Hope this helps
Get back to me if you need further help
Vincent Amiot
Principal Consultant / Aonix  

Denny <vrandezo@trick.informatik.uni-stuttgart.de> wrote in article
<Pine.GSO.4.10.9904231559080.7427-100000@tick.informatik.uni-stuttgart.de>..




      parent reply	other threads:[~1999-05-04  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-23  0:00 Very big Integers Denny
1999-04-23  0:00 ` Samuel Mize
1999-04-24  0:00   ` bglbv
1999-04-25  0:00     ` Robert Dewar
1999-04-29  0:00       ` bglbv
1999-04-25  0:00     ` Matthew Heaney
1999-04-29  0:00       ` bglbv
1999-04-26  0:00 ` Dmitri Anisimkov
1999-05-04  0:00 ` Vincent P. Amiot [this message]
replies disabled

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