diff --git a/docs/src/functions/images/tangent-curve.png b/docs/src/functions/images/tangent-curve.png new file mode 100644 index 0000000..e4b3fcf Binary files /dev/null and b/docs/src/functions/images/tangent-curve.png differ diff --git a/docs/src/functions/math-and-trigonometry.md b/docs/src/functions/math-and-trigonometry.md index c225af6..0359358 100644 --- a/docs/src/functions/math-and-trigonometry.md +++ b/docs/src/functions/math-and-trigonometry.md @@ -90,6 +90,6 @@ You can track the progress in this [GitHub issue](https://github.com/ironcalc/Ir | SUMX2MY2 | | – | | SUMX2PY2 | | – | | SUMXMY2 | | – | -| TAN | | – | +| TAN | | [TAN](math_and_trigonometry/tan) | | TANH | | – | | TRUNC | | – | diff --git a/docs/src/functions/math_and_trigonometry/tan.md b/docs/src/functions/math_and_trigonometry/tan.md index b8303c7..3e48e5c 100644 --- a/docs/src/functions/math_and_trigonometry/tan.md +++ b/docs/src/functions/math_and_trigonometry/tan.md @@ -3,9 +3,42 @@ layout: doc outline: deep lang: en-US --- - -# TAN - +# TAN function ::: warning -🚧 This function is implemented but currently lacks detailed documentation. For guidance, you may refer to the equivalent functionality in [Microsoft Excel documentation](https://support.microsoft.com/en-us/office/excel-functions-by-category-5f91f4e9-7b42-46d2-9bd1-63f26a86c0eb). -::: \ No newline at end of file +**Note:** This draft page is under construction 🚧 +::: +## Overview +TAN is a function of the Math and Trigonometry category that calculates the trigonometric tangent of an angle, returning a value in the range (-$\infty$, +$\infty$). +## Usage +### Syntax +**TAN(angle) => tan** +### Argument descriptions +* *angle* ([number](/features/value-types#numbers), required). The angle whose tangent is to be calculated, expressed in radians. To convert between degrees and radians, use the relation below. Alternatively, use the [DEGREES](/functions/math_and_trigonometry/degrees) or [RADIANS](/functions/math_and_trigonometry/radians) functions. +$$ +1~\:~\text{degree} = \dfrac{\pi}{180} = 0.01745329252~\text{radians} +$$ + +### Additional guidance +None. +### Returned value +TAN returns a unitless [number](/features/value-types/#numbers) that is the trigonometric tangent of the specified angle. +### Error conditions +* In common with many other IronCalc functions, TAN propagates errors that are found in its argument. +* If no argument, or more than one argument, is supplied, then TAN returns the [`#ERROR!`](/features/error-types.md#error) error. +* If the value of the *angle* argument is not (or cannot be converted to) a [number](/features/value-types#numbers), then TAN returns the [`#VALUE!`](/features/error-types.md#value) error. +* For some argument values, TAN may return a [`#DIV/0!`](/features/error-types.md#div-0) error. + +## Details +* The TAN function utilizes the *tan()* method provided by the [Rust Standard Library](https://doc.rust-lang.org/std/). +* The figure below illustrates the output of the TAN function for angles $x$ in the range -2$π$ to +2$π$. +
Graph showing tan(x) for x between -2π and +2π.
+ +* Theoretically, $\text{tan}(x)$ is undefined for any critical $x$ that satisfies $x = \frac{\pi}{2} + k\pi$ (where $k$ is any integer). However, an exact representation of the mathmatical constant $\pi$ requires infinite precision, which cannot be achieved with the floating-point representation available. Hence, TAN will return very large or very small values close to critical $x$ values. +## Examples +[See some examples in IronCalc](https://app.ironcalc.com/?example=tan). + +## Links +* For more information about trigonometric tangent, visit Wikipedia's [Trigonometric functions](https://en.wikipedia.org/wiki/Trigonometric_functions) page. +* See also IronCalc's [ATAN](/functions/math_and_trigonometry/atan), [COS](/functions/math_and_trigonometry/cos) and [SIN](/functions/math_and_trigonometry/sin) functions. +* Visit Microsoft Excel's [TAN function](https://support.microsoft.com/en-gb/office/tan-function-08851a40-179f-4052-b789-d7f699447401) page. +* Both [Google Sheets](https://support.google.com/docs/answer/3093586) and [LibreOffice Calc](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TAN) provide versions of the TAN function. \ No newline at end of file diff --git a/xlsx/tests/docs/TAN.xlsx b/xlsx/tests/docs/TAN.xlsx new file mode 100644 index 0000000..4fda7bb Binary files /dev/null and b/xlsx/tests/docs/TAN.xlsx differ