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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public X-Google-Thread: 10a146,fee8802cc3d8334d X-Google-Attributes: gid10a146,public From: Marin David Condic Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/23 Message-ID: <3771417A.1541648A@pwfl.com>#1/1 X-Deja-AN: 493076452 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <3766650F.705125B7@pwfl.com> <7k64t7$igo$1@its.hooked.net> <7k689a$ci2@drn.newsguy.com> <3766C842.E1EAB60A@pwfl.com> <7kp3f2$m9i$1@nnrp1.deja.com> <3770F79C.42132886@pwfl.com> <930160826.778.37@news.remarQ.com> <37873d89.955250958@news.bctel.ca> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada,comp.lang.java.programmer Date: 1999-06-23T00:00:00+00:00 List-Id: Roedy Green wrote: > > By "saturation" you mean the same thing as Abundance "corralling"? > When a variable value gets too big, you automatically corral it back > to the maximum declared allowable value for that variable. > If I understand you correctly, the answer is "yes". In Ada, it would look sort of like this: X : Integer := Integer'Last ; -- Contains max value for type integer. ... X := X + 1 ; -- No overflow - X contains Integer'Last There is no "standard" way of getting this behavior in Ada so typically you have to implement your own data type and operations. The only problem is that you really need to have your math behave with all due speed, so you degenerate to assembler or end up fussing around in other ways that don't lend themselves to portability or good abstractions. I'd prefer to get the support in hardware and have the compiler give me data types (float, fixed and integer) that lined up with the hardware. MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 ***To reply, remove "bogon" from the domain name.*** Visit my web page at: http://www.mcondic.com/