test-powl.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Test for powl
  2. Copyright (C) 2011-2016 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 <stdio.h>
  16. #include <math.h>
  17. #include <float.h>
  18. #include <ieee754.h>
  19. static int
  20. do_test (void)
  21. {
  22. int result = 0;
  23. #ifndef NO_LONG_DOUBLE
  24. # if LDBL_MANT_DIG == 64
  25. {
  26. long double x = 1e-20;
  27. union ieee854_long_double u;
  28. u.ieee.mantissa0 = 1;
  29. u.ieee.mantissa1 = 1;
  30. u.ieee.exponent = 0;
  31. u.ieee.negative = 0;
  32. (void) powl (0.2, u.d);
  33. x = powl (x, 1.5);
  34. if (fabsl (x - 1e-30) > 1e-10)
  35. {
  36. printf ("powl (1e-20, 1.5): wrong result: %Lg\n", x);
  37. result = 1;
  38. }
  39. }
  40. # endif
  41. #endif
  42. return result;
  43. }
  44. #define TEST_FUNCTION do_test ()
  45. #include "../test-skeleton.c"