1
/* Test file for hyperbolic function : mpfr_cosh, mpfr_sinh, mpfr_tanh, mpfr_acosh, mpfr_asinh, mpfr_atanh.
3
Copyright 2001, 2002 Free Software Foundation, Inc.
5
This file is part of the MPFR Library.
7
The MPFR Library is free software; you can redistribute it and/or modify
8
it under the terms of the GNU Lesser General Public License as published
10
the Free Software Foundation; either version 2.1 of the License, or (at youroption) any later version.
12
The MPFR Library is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
License for more details.
16
You should have received a copy of the GNU Lesser General Public License
17
along with the MPFR Library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19
MA 02111-1307, USA. */
25
#include "mpfr-impl.h"
28
int check_O _PROTO((void));
29
int check_NAN _PROTO((void));
30
int check_zero _PROTO((void));
31
int check_INF _PROTO((void));
39
mpfr_t t, ch,sh,th,ach,ash,ath;
54
tester=mpfr_cosh(ch,t,GMP_RNDD);
55
if (!MPFR_IS_NAN(ch) || tester!=0 )
57
printf("cosh NAN \n");
70
tester=mpfr_sinh(sh,t,GMP_RNDD);
71
if (!MPFR_IS_NAN(sh) || tester!=0 )
73
printf("sinh NAN \n");
86
tester=mpfr_tanh(th,t,GMP_RNDD);
87
if (!MPFR_IS_NAN(th) || tester!=0 )
89
printf("tanh NAN \n");
100
/******acosh********/
102
tester=mpfr_acosh(ach,t,GMP_RNDD);
103
if (!MPFR_IS_NAN(ach) || tester!=0 )
105
printf("acosh NAN \n");
109
/******asinh********/
111
tester=mpfr_asinh(ash,t,GMP_RNDD);
112
if (!MPFR_IS_NAN(ash) || tester!=0 )
114
printf("asinh NAN \n");
125
/******atanh********/
127
tester=mpfr_atanh(ath,t,GMP_RNDD);
128
if (!MPFR_IS_NAN(ath) || tester!=0 )
130
printf("atanh NAN \n");
156
mpfr_t t, ch,sh,th,ach,ash,ath;
168
mpfr_set_ui(t,0,GMP_RNDD);
172
tester=mpfr_cosh(ch,t,GMP_RNDD);
173
if (!mpfr_cmp_ui(ch,1) || !tester )
175
printf("cosh(0) \n");
188
tester=mpfr_sinh(sh,t,GMP_RNDD);
189
if (!MPFR_IS_ZERO(sh) || !tester )
191
printf("sinh(0) \n");
204
tester=mpfr_tanh(th,t,GMP_RNDD);
205
if (!MPFR_IS_ZERO(th) || !tester )
207
printf("tanh(0) \n");
218
/******acosh********/
220
tester=mpfr_acosh(ach,t,GMP_RNDD);
221
if (!MPFR_IS_NAN(ach) || tester != -1 )
223
printf("acosh(0) \n");
234
/******asinh********/
236
tester=mpfr_asinh(ash,t,GMP_RNDD);
237
if (!MPFR_IS_ZERO(ash) || !tester )
239
printf("asinh(0) \n");
250
/******atanh********/
252
tester=mpfr_atanh(ath,t,GMP_RNDD);
253
if (!MPFR_IS_ZERO(ath) || !tester )
255
printf("atanh(0) \n");
282
mpfr_t t, ch,sh,th,ach,ash,ath;
302
tester = mpfr_cosh(ch,t,GMP_RNDD);
303
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0 )
305
printf("cosh(INF) \n");
318
tester=mpfr_sinh(sh,t,GMP_RNDD);
319
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0 )
321
printf("sinh(INF) \n");
334
tester=mpfr_tanh(th,t,GMP_RNDD);
335
if (mpfr_cmp_ui(th,1) != 0 || tester!=0 )
337
printf("tanh(INF) \n");
348
/******acosh********/
350
tester=mpfr_acosh(ach,t,GMP_RNDD);
351
if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0 )
353
printf("acosh(INF) \n");
364
/******asinh********/
366
tester=mpfr_asinh(ash,t,GMP_RNDD);
367
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0 )
369
printf("asinh(INF) \n");
380
/******atanh********/
382
tester=mpfr_atanh(ath,t,GMP_RNDD);
383
if (!MPFR_IS_INF(ath) || tester != 0)
385
printf("atanh(INF) \n");
400
tester=mpfr_cosh(ch,t,GMP_RNDD);
401
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0 )
403
printf("cosh(-INF) \n");
416
tester=mpfr_sinh(sh,t,GMP_RNDD);
417
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0 )
419
printf("sinh(-INF) \n");
432
tester=mpfr_tanh(th,t,GMP_RNDD);
433
if (!mpfr_cmp_ui(th,-1) || tester!=0 )
435
printf("tanh(-INF) \n");
446
/******acosh********/
448
tester=mpfr_acosh(ach,t,GMP_RNDD);
449
if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0 )
451
printf("acosh(-INF) \n");
462
/******asinh********/
464
tester=mpfr_asinh(ash,t,GMP_RNDD);
465
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0 )
467
printf("asinh(-INF) \n");
478
/******atanh********/
480
tester=mpfr_atanh(ath,t,GMP_RNDD);
481
if (!MPFR_IS_INF(ath) || MPFR_SIGN(ath) > 0 || tester != 0 )
483
printf("atanh(-INF) \n");
511
mpfr_t t, ch,sh,th,ach,ash,ath;
521
mpfr_set_ui(t,2,GMP_RNDD);
523
/******acosh o cosh********/
525
mpfr_cosh(ch,t,GMP_RNDN);
526
mpfr_acosh(ach,ch,GMP_RNDN);
527
if(mpfr_cmp_ui(ach,2)!=0)
529
printf("cosh o acosh \n");
540
/******asinh o sinh********/
542
mpfr_sinh(sh,t,GMP_RNDN);
543
mpfr_asinh(ash,sh,GMP_RNDN);
544
if(mpfr_cmp_ui(ash,2)!=0)
546
printf("sinh o asinh \n");
558
/******atanh o tanh********/
560
mpfr_tanh(th,t,GMP_RNDN);
561
mpfr_atanh(ath,th,GMP_RNDU);
564
mpfr_out_str(stdout, 2,40,th,GMP_RNDN);
567
mpfr_out_str(stdout, 2,40,ath,GMP_RNDU);
571
if(mpfr_cmp_ui(ath,2)!=0)
573
printf("tanh o atanh \n");
600
if (check_INF())printf("Error in evaluation of INF\n");
601
if (check_NAN())printf("Error in evaluation of NAN\n");
602
/*if (check_O())printf("Error in evaluation of composition hyperbolic function\n");*/