libm-test-significand.inc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Test significand.
  2. Copyright (C) 1997-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include "libm-test-driver.c"
  16. static const struct test_f_f_data significand_test_data[] =
  17. {
  18. #if !TEST_FLOATN
  19. /* significand returns the mantissa of the exponential
  20. representation. Tests for infinities, zero and NaNs reflect
  21. the implementation (including possibility of "inexact" and
  22. variations between architectures) rather than any
  23. specification. */
  24. TEST_f_f (significand, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
  25. TEST_f_f (significand, -qnan_value, qnan_value, INVALID_EXCEPTION_OK),
  26. TEST_f_f (significand, snan_value, qnan_value, INVALID_EXCEPTION),
  27. TEST_f_f (significand, -snan_value, qnan_value, INVALID_EXCEPTION),
  28. TEST_f_f (significand, plus_infty, plus_infty, INVALID_EXCEPTION_OK),
  29. TEST_f_f (significand, minus_infty, minus_infty, INVALID_EXCEPTION_OK),
  30. TEST_f_f (significand, 0, 0, INVALID_EXCEPTION_OK|DIVIDE_BY_ZERO_EXCEPTION_OK),
  31. TEST_f_f (significand, minus_zero, minus_zero, INVALID_EXCEPTION_OK|DIVIDE_BY_ZERO_EXCEPTION_OK),
  32. TEST_f_f (significand, min_value, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  33. TEST_f_f (significand, -min_value, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  34. TEST_f_f (significand, min_subnorm_value, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  35. TEST_f_f (significand, -min_subnorm_value, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  36. TEST_f_f (significand, 1.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  37. TEST_f_f (significand, -1.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  38. TEST_f_f (significand, 4.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  39. TEST_f_f (significand, -4.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  40. TEST_f_f (significand, 6.0, 1.5, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  41. TEST_f_f (significand, -6.0, -1.5, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  42. TEST_f_f (significand, 8.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  43. TEST_f_f (significand, -8.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
  44. #endif
  45. };
  46. static void
  47. significand_test (void)
  48. {
  49. #if !TEST_FLOATN
  50. ALL_RM_TEST (significand, 1, significand_test_data, RUN_TEST_LOOP_f_f, END);
  51. #endif
  52. }
  53. static void
  54. do_test (void)
  55. {
  56. significand_test ();
  57. }
  58. /*
  59. * Local Variables:
  60. * mode:c
  61. * End:
  62. */