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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,689ab254fbb71c5,start X-Google-Attributes: gid103376,public From: Sreedhar Chintalapaty Subject: Help on deciding a data type. Date: 1996/09/03 Message-ID: <322C50E0.167E@sdrc.com>#1/1 X-Deja-AN: 178206361 distribution: world content-type: text/plain; charset=us-ascii organization: SDRC - Ford Program Office mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; IRIX 5.3 IP22) Date: 1996-09-03T00:00:00+00:00 List-Id: 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!! _/ _/ _/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/