<!--Define JavaScript functions. -->

function CalcMachEps(dataForm){

var temp1, temp2, mchEps;

// Find machine epsilon by brute force; the algorithm should be general enough
// to port to other machines, operating systems, etc.
// epsmch is the smallest positive number such that 1.0 + epsmch is not equal to 1.0
// In the MSDN Library, DBL_EPSILON is 2.2204460492503131e-16
// accessed by using #include <float.h>

temp1 = 1.0;
do {
 mchEps = temp1;
 temp1 /= 2.0;
 temp2 = 1.0 + temp1;
} while (temp2 > 1.0); // End do-while loop
//At this point, mchEps should equal the machine precision, epsmch
dataForm.epsRes.value = mchEps;

return;
}  //End of CalcMachEps

// end of JavaScript-->
