Computational Physics Lab Test 2011: 1 The Problem
Computational Physics Lab Test 2011: 1 The Problem
The Problem
Problem 1: Encode the following algorithm and run it to determine the smallest positive number that can be represented on the computer you are using: input s <--- 1.0 for k=1,2,3,...,100 do s <--- 0.5 s t <--- s + 1.0 if t <= 1.0 then s <--- 2.0 s output k-1, s stop endif end Do this for both single precision and double precision oating point numbers.
2
2.1
Method
The program
} }
2.2
For Double : 52 th term is Computer Epsilon 2.220446e-16 For Float: 23 th term is Computer Epsilon 1.192093e-07
Results
We get the Computer Epsilon for the specic computer on which it is run.
Computer epsilons for oat and double are dierent.Double has more precision and the epsilon for double is hence smaller.Any value beyond computer epsilon is insignicant to us and bears no meaning. OS: Fedora 16 Text Editor : vi,gedit Prepared using : TEX