comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: Bignum modular types in Ada95
Date: 1998/01/29
Date: 1998-01-29T00:00:00+00:00	[thread overview]
Message-ID: <34D082F9.ABEC0D3B@elca-matrix.ch> (raw)
In-Reply-To: EnIIvn.3zr@world.std.com


> No.  Not really.  I guess there's one minor point: there's this thing
> called System.Max_Int, and it has to be some finite integer.  And some
> people write code that uses Max_Int to produce "the largest supported
> signed integer type", and, perhaps, expect that type to be reasonably
> efficient.  It's mainly that the Ada 9X project had no mandate to make
> any such wild-eyed changes.

And there is the fact that parameters of elementary types have to be passed by
copy, something you probably don't want for types with sizes around 1000 bits.

> Every Ada compiler includes a package for arbitrary-range integer
> arithmetic -- it's required, to do static expressions properly at
> compile time.  It's annoying (to me) that this implementation burden is
> required, but the user can't take advantage of it, portably, except in
> the case of static expressions.

I think it's reasonable the way it is (required in the compiler but not in the
runtime) because it's not needed for most applications, and the compiler can
have a quick and dirty, slow implementation that leaks memory without anyone caring.

The implementation, and even the spec of a bignum package is not that easy to
standardize, here are a few problems:

- Allow numbers of any size ? This requires tagged types and finalization,
which costs a lot in performance.

- Are the numbers _really_ big ? In this case, you will implement
multiplication and division using Fourier transforms, which is overkill for
medium size bignums.

- Only integers or reals as well ?

- ...




  parent reply	other threads:[~1998-01-29  0:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-27  0:00 Bignum modular types in Ada95 Markus Kuhn
1998-01-28  0:00 ` Markus Kuhn
1998-01-28  0:00   ` Brian Rogoff
1998-01-29  0:00     ` Markus Kuhn
1998-01-30  0:00       ` Brian Rogoff
1998-02-01  0:00   ` Robert Dewar
1998-02-02  0:00     ` Tarjei T. Jensen
1998-02-02  0:00       ` Robert Dewar
1998-02-03  0:00         ` Tarjei T. Jensen
1998-02-04  0:00           ` Keith Thompson
     [not found]   ` <EnIIvn.3zr@world.std.com>
1998-01-29  0:00     ` Mats Weber [this message]
     [not found]       ` <EnKEtu.KGp@world.std.com>
1998-01-30  0:00         ` Markus Kuhn
1998-01-30  0:00           ` Mats Weber
1998-01-30  0:00             ` Markus Kuhn
1998-01-31  0:00               ` Nick Roberts
1998-02-01  0:00           ` Robert Dewar
1998-01-30  0:00         ` Mats Weber
1998-02-01  0:00           ` Robert Dewar
1998-02-01  0:00           ` Robert Dewar
1998-01-31  0:00         ` Nick Roberts
1998-02-01  0:00         ` Robert Dewar
1998-01-29  0:00     ` Markus Kuhn
1998-01-31  0:00       ` Nick Roberts
1998-02-01  0:00     ` Robert Dewar
1998-01-28  0:00 ` Nick Roberts
1998-01-28  0:00   ` Larry Kilgallen
1998-01-28  0:00   ` Nick Roberts
1998-02-01  0:00     ` Robert Dewar
1998-02-07  0:00       ` Nick Roberts
1998-02-09  0:00         ` Robert Dewar
1998-01-28  0:00 ` Dmitriy Anisimkov
replies disabled

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