Machine epsilon If someone could give me the exact values th
Machine epsilon. If someone could give me the exact values that would be very helpful
Consider the following floating point arithmetic operation fl(4000 + alpha) where fl indicates that we are carrying out the arithmetic in floating point. For what (approximate) values of alpha is the above floating point arithmetic operation equal to 4000?Solution
We can find this epsilon using a simple program.
What we do is take epsilon as 1.0 and successively multiply it by 0.5 until we get the desired result.
So running this program
#include <iostream>
using namespace std;
int main() {
float ep = 0.1f;
while((4000.0 + 0.5*ep) != 4000.0)
ep = 0.5*ep;
cout<<0.5*ep;
return 0;
}
The output would be
