acc1.c 637 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2007
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. /*
  7. * This file is originally a part of the GCC testsuite.
  8. */
  9. #include <common.h>
  10. #include <post.h>
  11. GNU_FPOST_ATTR
  12. #if CFG_POST & CFG_SYS_POST_FPU
  13. static double func (const double *array)
  14. {
  15. double d = *array;
  16. if (d == 0.0)
  17. return d;
  18. else
  19. return d + func (array + 1);
  20. }
  21. int fpu_post_test_math5 (void)
  22. {
  23. double values[] = { 0.1e-100, 1.0, -1.0, 0.0 };
  24. if (func (values) != 0.1e-100) {
  25. post_log ("Error in FPU math5 test\n");
  26. return -1;
  27. }
  28. return 0;
  29. }
  30. #endif /* CFG_POST & CFG_SYS_POST_FPU */