tan - gehrigwilcox/C-Standard-Library GitHub Wiki

tan(θ)

Tangent is the ratio between the y and x position on the unit circle.

{
  "width": 200,
  "height": 200,
  "data": {
    "sequence": {
      "start": 0,
      "stop": 6.28,
      "step": 0.01,
      "as": "theta"
    }
  },
  "transform": [
    {
      "calculate": "cos(datum.theta)",
      "as": "x"
    },
    {
      "calculate": "sin(datum.theta)",
      "as": "y"
    }
  ],
  "mark": "line",
  "encoding": {
    "x": {
      "type": "quantitative",
      "field": "x"
    },
    "y": {
      "field": "y",
      "type": "quantitative"
    }
  }
}

Since sine gives us the y position, and cosine gives us the x position, tangent is the relationship between sine and cosine. Mathematically,

$$\tan(\theta)=\frac{\sin(\theta)}{\cos(\theta)}$$

In C:

return sin(x)/cos(x);
⚠️ **GitHub.com Fallback** ⚠️