swarm-modeling
[Top][All Lists]
Advanced

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

Re: Swarm Futures re-cap


From: Andy Cleary
Subject: Re: Swarm Futures re-cap
Date: Tue, 15 Oct 2002 11:32:36 -0700

At 06:04 PM 10/15/2002 +0100, you wrote:

I'd be interested to hear how other people deal with floating points.

This is an entire academic discipline, basically. But for this kind of purpose, a little common sense is probably going to net you more bang for buck than learning an entire field... The comments below (about rounding etc) are good places to start: if you are doing a stochastic simulation with lots of error in its formulation, it doesn't make sense that your simulation should depend on the last digit of a floating point number. Round them and then do your logic. Also avoid things like testing for equality of floating point numbers; as you've seen, floating point arithmetic does not necessarily commute. Despite a background in these issues, I tend to think that only a very small community of people should actually know all that much about floating point arithmetic and that everyone else should be able to program largely without consideration of the details (don't tell my advisor that though).


I've never needed more than 5 or 6 decimal places of precision, and so I just floor, round, or ceiling as required. That's probably not what you wanted to know, though.

IIRC, there's a GNU library that provides arbitrary precision arithmetic.

Do NOT go this route if you care about performance at all. These kinds of packages generally achieve extra precision by performing arithmetic operations in software rather than hardware.

My 2c,
Andy Cleary

============================================
Andrew J. Cleary, Software Engineer/Computational Scientist
Lawrence Livermore National Labs, 925-424-5890.
============================================




                 ==================================
  Swarm-Modelling is for discussion of Simulation and Modelling techniques
  esp. using 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]