Difference between revisions of "Numerical Errors"

From SourceWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 
[[category:Pragmatic Programming]]
 
[[category:Pragmatic Programming]]
'''Unexpected things can happen when you use floating point numbers'''
+
'''Unexpected things can happen when you use floating point numbers!'''
  
 
=Introduction=
 
=Introduction=

Revision as of 14:43, 10 November 2008

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