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: 10a146,fee8802cc3d8334d X-Google-Attributes: gid10a146,public X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public From: "George W. Bayles" Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/16 Message-ID: <3767D597.8C77A423@cajunbro.com>#1/1 X-Deja-AN: 490314401 Content-Transfer-Encoding: 7bit References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <37667A00.2086E4F8@itools.symantec.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsabuse@remarQ.com X-Trace: 929551769.655.84 2BDTXNQOI54E1D18EC qube-02.us-ca.remarq.com Organization: Posted via RemarQ Communities, Inc. MIME-Version: 1.0 NNTP-Posting-Date: Wed, 16 Jun 1999 16:49:29 GMT Newsgroups: comp.lang.ada,comp.lang.java.programmer Date: 1999-06-16T00:00:00+00:00 List-Id: D'Arcy Smith wrote: [snip] > > '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 think you missed the implied - "depending on what the number > is being used for". That reminds me - using scaled integers to represent angles int theta = (int) MAX_INT*(theta_degrees/180.0); makes adding and subtracting angles much nicer because of the wrap around! It is a feature of computer integers that they are more like a compass than a ruler. > Reading this thread... it would be nice to have a Java compiler > that could generate checkes for overflows etc... perhaps a > new keyword like they did with 'strictfp'. This is something that would have to be added to the JVM specifications in order to do this efficiently - are there any byte codes left?