fmacheps.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**************************************************************************
  2. **
  3. ** Copyright (C) 1993 David E. Steward & Zbigniew Leyk, all rights reserved.
  4. **
  5. ** Meschach Library
  6. **
  7. ** This Meschach Library is provided "as is" without any express
  8. ** or implied warranty of any kind with respect to this software.
  9. ** In particular the authors shall not be liable for any direct,
  10. ** indirect, special, incidental or consequential damages arising
  11. ** in any way from use of the software.
  12. **
  13. ** Everyone is granted permission to copy, modify and redistribute this
  14. ** Meschach Library, provided:
  15. ** 1. All copies contain this copyright notice.
  16. ** 2. All modified copies shall carry a notice stating who
  17. ** made the last modification and the date of such modification.
  18. ** 3. No charge is made for this software or works derived from it.
  19. ** This clause shall not be construed as constraining other software
  20. ** distributed on the same medium as this software, nor is a
  21. ** distribution fee considered a charge.
  22. **
  23. ***************************************************************************/
  24. #include <stdio.h>
  25. double fclean(x)
  26. double x;
  27. {
  28. static float y;
  29. y = x;
  30. return y; /* prevents optimisation */
  31. }
  32. main()
  33. {
  34. static float feps, feps1, ftmp;
  35. feps = 1.0;
  36. while ( fclean(1.0+feps) > 1.0 )
  37. feps = 0.5*feps;
  38. printf("%g\n", 2.0*feps);
  39. }