1/* test file for digamma function 2 3Copyright 2009, 2010, 2011 Free Software Foundation, Inc. 4Contributed by the Arenaire and Cacao projects, INRIA. 5 6The GNU MPFR Library is free software; you can redistribute it and/or modify 7it under the terms of the GNU Lesser General Public License as published by 8the Free Software Foundation; either version 3 of the License, or (at your 9option) any later version. 10 11The GNU MPFR Library is distributed in the hope that it will be useful, but 12WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14License for more details. 15 16You should have received a copy of the GNU Lesser General Public License 17along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see 18http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 1951 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ 20 21#include <stdio.h> 22#include <stdlib.h> 23 24#include "mpfr-test.h" 25 26#define TEST_FUNCTION mpfr_digamma 27#include "tgeneric.c" 28 29static void 30special (void) 31{ 32 mpfr_t x, y; 33 34 mpfr_init (x); 35 mpfr_init (y); 36 37 mpfr_set_inf (y, -1); 38 mpfr_set_inf (x, 1); 39 mpfr_digamma (y, x, MPFR_RNDN); 40 if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) < 0) 41 { 42 printf ("error for Psi(+Inf)\n"); 43 printf ("expected +Inf\n"); 44 printf ("got "); 45 mpfr_dump (y); 46 exit (1); 47 } 48 49 mpfr_clear (x); 50 mpfr_clear (y); 51} 52 53int 54main (int argc, char *argv[]) 55{ 56 tests_start_mpfr (); 57 58 special (); 59 60 test_generic (2, 100, 2); 61 62 data_check ("data/digamma", mpfr_digamma, "mpfr_digamma"); 63 64 tests_end_mpfr (); 65 return 0; 66} 67