Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!j.cc.purdue.edu!brazil.psych.purdue.edu!zhou From: zhou@brazil.psych.purdue.edu (Albert Zhou) Newsgroups: comp.lang.pascal Subject: Re: SET Message-ID: <11567@j.cc.purdue.edu> Date: 26 Nov 90 16:40:52 GMT References: <25092@adm.brl.mil> Sender: news@j.cc.purdue.edu Reply-To: zhou@brazil.psych.purdue.edu (Albert Zhou) Organization: Purdue University Lines: 24 In article <25092@adm.brl.mil> PRDESENV%ORION.CPQD.ANSP.BR@uga.cc.uga.edu writes: >Hey, > > Does anybody know how can I build a SET with Real (or double) >elements in Turbo Pascal? I Only need a SET with 15 real numbers. There is no directly way of doing it in TP. But you can map these 15 reals to 0..14 and subsequently define a set of byte [0..14]. > > Once SET requires subranges with no more than 256 itens I can not >make a set of word (my real numbers have only one place after >the decimal point, so I could multiply by 10, solving the problem, but >the range from the first to the last overcome 256). It looks like you need to do certain non-linear transform so that you can map no more than 255 reals or integers into a set of byte (Multiplying by 10 is a kind of transform or mapping if you haven't aware, very simple linear transform though). > > I've tried to make a TYPE with these numbers but Turbo gives an >error saying "Error 2: Identifier expected" . As I remember, you can make subrange out of BYTE, CHAR, INTEGER and WORD (They are all ordinal). But you cannot make subrange out of REAL.