 License Public Domain
 Lines 38
##### Keywords machine precision (1)
##### Related The Newton-Raphson Method Eigenvectors and Eigenvalues Fixed Point Iteration Euclidian Norm Scary Voices
##### Permissions Owner: David Isaacson Viewable by Everyone Editable by All Siafoo Users

# Finding Epsilon 0

 In Brief Find the machine epsilon of a computer, that is, the smallest number E such that 1+E != 1 . (using single precision only)
 Language C
# 's
` 1/* By David Isaacson, 2003 2 * Released into the Public Domain 3 * 4 * epsilon.c 5 * The puropse of this program is to find the machine epsilon of this computer, that is, 6 * the smallest number E such that 1+E != 1 . (using single precision only) 7 */ 8 9#include <stdio.h>1011int main()12{13        float max = 1;		        //This is the lowest value that we know works.     14					//(By works, I mean that 1+E!=1)15	float min = 0;			//This is the highest value that we know doesn't work.16	float test = 0;			//This is our test varible. Duh.17	18	do             19	{20		test=(max+min)/2;	//Set test to avg of max & min21		22		if((1+test)!=1)		//If we're too high, set the max to test and try again23			max=test;	//(We're trying to center in on the right value)24		if((1+test)==1)		//If we're too low, set the min to test and try again25			min=test;2627	}while(test!=((max+min)/2));	//If max and min are not changing, they must be so 28					//close that there is no number in between that the29					//computer can represent.30					//So, either test=min= the highest value that31					//doesn't work, or test=max= the lowest32					//value that does work.  Either way we're done.3334	printf("The epsilon for your machine is %e.\n",max);35	//max is the lowest value that works. 3637	return 0;3839}4041/* When running this program on my computer (Power Mac G4 533 MHz running Mac OS X 10.2), I42 * recieved the result:43 *44 * The epsilon for your machine is 5.960465e-08.45 */`

Find the machine epsilon of a computer, that is, the smallest number E such that 1+E != 1 . (using single precision only)