amath  1.8.5
Simple command line calculator
cot.c File Reference

Cotangent function. More...

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

Go to the source code of this file.

Functions

double cot (double x)
 Cotangent function. More...
 

Detailed Description

Cotangent function.

Definition in file cot.c.

Function Documentation

◆ cot()

double cot ( double  x)

Cotangent function.

Parameters
x
cot(x) = 1/tan(x)
       = cos(x)/sin(x)
       = sin(2*x)/(cos(2*x)-1)

Definition at line 47 of file cot.c.

References cos(), and sin().

Referenced by RealNumber::Cotangent().

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