amath  1.8.5
Simple command line calculator
csc.c File Reference

Cosecant function. More...

#include "prim.h"
Include dependency graph for csc.c:

Go to the source code of this file.

Functions

double csc (double x)
 Cosecant function. More...
 

Detailed Description

Cosecant function.

Definition in file csc.c.

Function Documentation

◆ csc()

double csc ( double  x)

Cosecant function.

csc = sin(1/x)
    = -2*sin(x)/(cos(2*x) - 1)

Definition at line 45 of file csc.c.

References cos(), and sin().

Referenced by RealNumber::Cosecant(), and exc().

46 {
47  double a, b, c;
48 
49  b = cos(2.0 * x) - 1.0;
50  if (b == 0.0)
51  {
52  return NAN;
53  }
54 
55  a = -2.0 * sin(x);
56  c = a / b;
57  return c;
58 }
double sin(double x)
Sine function.
Definition: sin.c:86
double cos(double x)
Cosine function.
Definition: cos.c:87
#define NAN
Definition: mathr.h:53
Here is the call graph for this function:
Here is the caller graph for this function: