comp.lang.ada
 help / color / mirror / Atom feed
* Help on deciding a data type.
@ 1996-09-03  0:00 Sreedhar Chintalapaty
  1996-09-04  0:00 ` Stephen Bull
  0 siblings, 1 reply; 3+ messages in thread
From: Sreedhar Chintalapaty @ 1996-09-03  0:00 UTC (permalink / 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!!		    _/
_/								    _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/




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

end of thread, other threads:[~1996-09-05  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-09-03  0:00 Help on deciding a data type Sreedhar Chintalapaty
1996-09-04  0:00 ` Stephen Bull
1996-09-05  0:00   ` Robert I. Eachus

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