maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  1. Reference
  2. Mathematical operations

tan

PreviousexpNextarcsin

Last updated 9 months ago

Compute tangent of a given argument

tan(x);

will return the tangent of an argument, expressed in radians. There is no custom return type, the function always returns an double.

tan(0); // 0
tan(PI / 6) == tan(degToRad<float>(30); // 1/sqrt(3) = 0.577
tan(PI / 4) == tan(degToRad<float>(45); // 1
tan(PI / 3) == tan(degToRad<float>(60); // sqrt(3) = 1.732
tan(PI / 2) == tan(degToRad<float>(90); // 0, not infinity!
tan(-PI / 6) == tan(degToRad<float>(-30); // -0.577

Make sure you are passing radians as a argument. You can easily use function to convert it within the argument itself.

😱
degToRad