acc1.c 652 B

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