signgam.c 466 B

12345678910111213141516171819202122232425262728
  1. #define _XOPEN_SOURCE 600
  2. #include <math.h>
  3. #include <float.h>
  4. #include <stdio.h>
  5. double zero = 0.0;
  6. double mzero;
  7. int main(void)
  8. {
  9. double d;
  10. int errors = 0;
  11. mzero = copysign(zero, -1.0);
  12. d = lgamma(zero);
  13. printf("%g %d\n", d, signgam);
  14. errors += !(d == HUGE_VAL);
  15. errors += !(signgam == 1);
  16. d = lgamma(mzero);
  17. printf("%g %d\n", d, signgam);
  18. errors += !(d == HUGE_VAL);
  19. errors += !(signgam == -1);
  20. printf("Errors: %d\n", errors);
  21. return errors;
  22. }