swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integer arithmetic in Java


From: Russell Standish
Subject: Re: Integer arithmetic in Java
Date: Wed, 5 Dec 2001 09:59:53 +1100 (EST)

This is a well known feature of many languages, including C and
Fortran. I remember being flummuxed myself by this when I first came
across it in the late '80s, since my first computer language (Pascal)
actually produces a floating point number in the context (there exists
a special "div" operator to get integer truncation).

                                                Cheers

M Lang / S Railsback wrote:
> 
> 
> In de-bugging our first model in Java Swarm we finally figured out that:
> 
>       aFloat = (anInt) / (anotherInt);
> 
> gives aFloat a value truncated to a whole number. (We were doing
> movement calculations on a 2D grid with integer coordinates, trying to
> figure out why the critters ended up in the wrong places.)
> 
> Pardon my inexperience, but is that something that everybody knows? It
> certainly seems like a way to introduce undetected errors...IF we
> weren't blessed with Swarm probe displays and GUIs to find them!
> 
> Steve
> 
> -- 
> address@hidden
> Lang, Railsback & Assoc.
> 250 California Ave., Arcata CA 95521
> 707-822-0453; Fax 822-1868
> 
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
> 



----------------------------------------------------------------------------
Dr. Russell Standish                     Director
High Performance Computing Support Unit, Phone 9385 6967, 8308 3119 (mobile)
UNSW SYDNEY 2052                         Fax   9385 6965, 0425 253119 (")
Australia                                address@hidden             
Room 2075, Red Centre                    http://parallel.hpc.unsw.edu.au/rks
            International prefix  +612, Interstate prefix 02
----------------------------------------------------------------------------

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]