Numerical Errors

From SourceWiki
Revision as of 14:43, 10 November 2008 by GethinWilliams (talk | contribs)
Jump to navigation Jump to search

Unexpected things can happen when you use floating point numbers!

Introduction

Sooner or later, you're going to want to include real--aka floating point--numbers in your programs. These could be for measured quantities, or parameterisations. One thing's for sure, however, integers don't always cut it. Now this is all fine and as it should be. A word of warning, however. Programs containing floating point numbers can do very odd things indeed! Use them with care.

I didn't expect that!

Let's take a look at our first example.

svn co http://source.ggy.bris.ac.uk/subversion-open/numerics/trunk ./numerics
cd numerics/examples/example1


Algorithms Matter

Deterministic, yes. Outputs, different