summaryrefslogtreecommitdiff
path: root/src/test/testCosh.c
blob: 0efb9868aaf300b194fb403ec81f5c1d5a782641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
**  -*- C -*-
**
** testCosh.c
** Made by  Bruno JOFRET <bruno.jofret@inria.fr>
**
** Started on  Fri Dec  8 15:05:44 2006 jofret
** Last update Mon Jan 29 16:15:15 2007 jofret
**
** Copyright INRIA 2006
*/

#include <stdio.h>

#define PI 3.1415826535

float scoshs(float);
double dcoshs(double);


void scoshsTest() {
  printf(">> Float scalar\n");
  printf("scoshs(0) = %f\n", scoshs((float) 0));
  printf("scoshs(PI) = %f\n", scoshs(PI));
  printf("scoshs(PI/2) = %f\n", scoshs(PI/2));
  printf("scoshs(PI/3) = %f\n", scoshs(PI/3));
  printf("scoshs(PI/4) = %f\n", scoshs(PI/4));
  printf("scoshs(PI/6) = %f\n", scoshs(PI/6));
  printf("scoshs(-PI) = %f\n", scoshs(-PI));
  printf("scoshs(-PI/2) = %f\n", scoshs(-PI/2));
  printf("scoshs(-PI/3) = %f\n", scoshs(-PI/3));
  printf("scoshs(-PI/4) = %f\n", scoshs(-PI/4));
  printf("scoshs(-PI/6) = %f\n", scoshs(-PI/6));
}

void dcoshsTest() {
  printf(">> Double scalar\n");
  printf("dcoshs(0) = %e\n", dcoshs((double) 0));
  printf("dcoshs(PI) = %e\n", dcoshs(PI));
  printf("dcoshs(PI/2) = %e\n", dcoshs(PI/2));
  printf("dcoshs(PI/3) = %e\n", dcoshs(PI/3));
  printf("dcoshs(PI/4) = %e\n", dcoshs(PI/4));
  printf("dcoshs(PI/6) = %e\n", dcoshs(PI/6));
  printf("dcoshs(-PI) = %e\n", dcoshs(-PI));
  printf("dcoshs(-PI/2) = %e\n", dcoshs(-PI/2));
  printf("dcoshs(-PI/3) = %e\n", dcoshs(-PI/3));
  printf("dcoshs(-PI/4) = %e\n", dcoshs(-PI/4));
  printf("dcoshs(-PI/6) = %e\n", dcoshs(-PI/6));
}

int testCosh() {
  printf(">>>> Hyperbolic Cosine Tests\n");
  scoshsTest();
  dcoshsTest();
  return 0;
}