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: aidan@skinner.demon.co.uk (Aidan Skinner) Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/17 Message-ID: #1/1 X-Deja-AN: 490733653 X-NNTP-Posting-Host: skinner.demon.co.uk:158.152.76.219 References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <37667A00.2086E4F8@itools.symantec.com> <3767D597.8C77A423@cajunbro.com> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 929639150 nnrp-13:7798 NO-IDENT skinner.demon.co.uk:158.152.76.219 Organization: None User-Agent: slrn/0.9.5.4 (UNIX) Reply-To: aidan@skinner.demon.co.uk Newsgroups: comp.lang.ada,comp.lang.java.programmer Date: 1999-06-17T00:00:00+00:00 List-Id: On Wed, 16 Jun 1999 11:49:27 -0500, George W. Bayles wrote: >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 But in Ada you could just use a type similar to this: type degree is mod 360; theta : degree := 0; to achieve the same nice wrap around effect with less convulated code. It's one of the things I really like about Ada: you can generally achieve the semantics you want easily with a little bit of knowledge. - Aidan (read the RM, know the RM. The RM is your friend. Trust the RM) -- http://www.skinner.demon.co.uk/aidan/ Horses for courses, tac-nukes to be sure.