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: 10a146,fee8802cc3d8334d X-Google-Attributes: gid10a146,public X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/15 Message-ID: <3766650F.705125B7@pwfl.com>#1/1 X-Deja-AN: 489863848 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> 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-15T00:00:00+00:00 List-Id: mike@world.nospam.com wrote: > > 'The result of an overflow isn't necessarily the wrong number' the bank > attorney replies. (flaged on the side by the bank top Java consultant ready > to supply more therotical evidence that supports such a statment). > I'm of the opinion that if one wishes behavior different from that of "normal" arithmetic, then this should be specified by a type with special properties. One acustomed to normal arithmetic is going to believe that X := X + 1 will yield the successor of X in the set of all integer numbers. If that isn't possible because of real world limitations, then we have encountered an exceptional condition which ought to raise some sort of flag and warn the world that the anticipated behavior was not achieved. If one wants wraparound semantics, then perhaps there should be a special type to support that behavior - a la modular types in Ada. (Although these don't contain negative numbers and that may be a requirement.) In some cases, saturation semantics are a good thing, but again, this is not the "normal" understanding of arithmetic and therefore should be supported by a special type. 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/