swarm-support
[Top][All Lists]
Advanced

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

Integer arithmetic in Java


From: M Lang / S Railsback
Subject: Integer arithmetic in Java
Date: Tue, 04 Dec 2001 15:07:35 -0700

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.


reply via email to

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