[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swarm-Modelling] Floating point arithmetic
From: |
Gary Polhill |
Subject: |
[Swarm-Modelling] Floating point arithmetic |
Date: |
Thu, 28 Apr 2005 10:06:20 +0100 |
Way back in October 2002, I mailed this list about some problems I was
having
with floating point arithmetic. With colleagues, I have written a
couple of
publications on this in recent issues of JASSS, and one forthcoming in
Environmental Modelling and Software. One thing I have learned from all
this
that is particularly relevant to Swarm (and rival platforms) is that
Swarm's
Objective-C base allows access to the IEEE 754 stipulated routines (in
ieeefp.h)
that allow programmers to check for floating point errors and control
the
rounding direction. Java, by contrast, does not -- something for which
it is
criticised by floating point experts such as William Kahan
(http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf).
For Java to be taken seriously as a language for scientific
programming, it
needs to treat floating point arithmetic with the respect it deserves,
and
implement the IEEE 754 stipulated functionality to achieve full
compliance with
the standard. I've logged some requests for enhancement with Sun about
this, and
they will only get implemented if enough people support them, by voting
for
them. I have a page on them at
http://www.macaulay.ac.uk/fearlus/floating-point/javabugs.html,
but if you want to access the RFEs directly (you will need to join the
sun
developer network community to do so...), you can do this at:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5095286
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5095600
Even if you don't think you'll ever use the routines yourself, I hope
you'll agree
that you should have the right to inspect floating point exceptions in
Java,
just in case you do come across a problem with your Java code that
might be
attributable to fp issues.
Until Sun implement the changes, Obj-C Swarm users can at least enjoy a
small
feeling of smugness that they are using a more numerically rigorous
platform...
(There is one exception -- Cygwin doesn't implement the routines in
ieeefp.h
(you get linking errors if you try). I have partially addressed this
issue by
implementing some of them for Intel chips. See the CIieeefp package at
http://www.macaulay.ac.uk/fearlus/floating-point/download.html.)
Gary Polhill
Research Scientist
The Macaulay Institute
Craigiebuckler
Aberdeen AB15 8QH
UK
Tel: +(44) (0)1224 498200 Ext 2238
Fax: +(44) (0)1224 311556
e-mail: address@hidden
http://www.macaulay.ac.uk/
http://www.macaulay.ac.uk/fearlus/
- [Swarm-Modelling] Floating point arithmetic,
Gary Polhill <=