From: Sreedhar Chintalapaty <Sreedhar.Chintalapaty@sdrc.com>
Subject: Help on deciding a data type.
Date: 1996/09/03
Date: 1996-09-03T00:00:00+00:00 [thread overview]
Message-ID: <322C50E0.167E@sdrc.com> (raw)
Hi,
I am writing an Ada program to simulate error control codes in which I
need to decide upon a data type to represent entries in the so called
Zech's Logarithm tables. These tables are of the following format:
(I am giving an actual example for whatever it is worth)
______________________________________________________________________
LOG_A | LOG_A_PLUS_ONE
------------------------|---------------------------------------------
0 | *
1 | 3
2 | 6
3 | 1
4 | 5
5 | 4
6 | 2
----------------------------------------------------------------------
Except for the first entry, the numbers are all mod N, with N=7 here.
Also, the arithmetic operations (*) adn (/) are done mod N, so the
data type could be defined as
type Symbol is mod N; -- (N = 7 here)
The problem is with the * in the first entry: Generally, it is
represented as -1. In reality, it is indeterminate.
Is there a way to define some data type here that would let me
exploit the modular mathematics capability of Ada while at the same
time having some representation for the * in the first entry? Or do
I have to resort to definig it as, for instance
type Symbol is Integer range -1..N;
and write my own methods to overload the multiplication and division
functions?
I would be grateful for any help/pointers to help in this regard.
Sree
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _/
_/ SREEDHAR CHINTALAPATY 1555, FairLane Dr. Ste.300 _/
_/ SDRC - PIM Deployment AllenPark MI 48101 _/
_/ _/
_/ Phone: 313.317.6098 Email: Sreedhar.Chintalapaty@sdrc.com _/
_/ WWW: http://www.ee.memphis.edu/~sreedhar/Upanisad/upanisad.html _/
_/ _/
_/ - = o 0 o = - _/
_/ _/
_/ I am having amnesia and deja vu at the same time! _/
_/ I think I have forgotten all this before!! _/
_/ _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
next reply other threads:[~1996-09-03 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-09-03 0:00 Sreedhar Chintalapaty [this message]
1996-09-04 0:00 ` Help on deciding a data type Stephen Bull
1996-09-05 0:00 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox