Skip to content

Commit 767a250

Browse files
docs: add C# Math.Atanh() documentation (#7982)
* docs: add C# Math.Atanh() documentation Added comprehensive documentation for Math.Atanh() method including: - Description of inverse hyperbolic tangent functionality - Syntax section with parameter details - Return value specifications including edge cases - Practical example with multiple test cases - Runnable codebyte example Fixes #7946 * fix: correct formatting and spacing in atanh.md * minor content fixes * Update atanh.md ---------
1 parent 9f01639 commit 767a250

File tree

1 file changed

+82
-0
lines changed
  • content/c-sharp/concepts/math-functions/terms/atanh

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
Title: 'Atanh()'
3+
Description: 'Returns the inverse hyperbolic tangent of a number.'
4+
Subjects:
5+
- 'Computer Science'
6+
- 'Code Foundations'
7+
Tags:
8+
- 'Arithmetic'
9+
- 'Methods'
10+
- 'Numbers'
11+
CatalogContent:
12+
- 'learn-c-sharp'
13+
- 'paths/computer-science'
14+
---
15+
16+
The **`Math.Atanh()`** method returns the inverse hyperbolic tangent (hyperbolic arctangent) of a specified number. The inverse hyperbolic tangent is the value whose hyperbolic tangent is the input number.
17+
18+
## Syntax
19+
20+
```pseudo
21+
Math.Atanh(value);
22+
```
23+
24+
**Parameters:**
25+
26+
- `value`: A double-precision floating-point number in the range `-1` to `1`, representing the hyperbolic tangent value.
27+
28+
**Return value:**
29+
30+
The `Math.Atanh()` method returns the inverse hyperbolic tangent of the given `value` as a `double`.
31+
32+
It returns:
33+
34+
- `NaN` (Not a Number) if the `value` is less than `-1` or greater than `1`.
35+
- `NegativeInfinity` if the `value` is exactly `-1`.
36+
- `PositiveInfinity` if the `value` is exactly `1`.
37+
38+
## Example: Basic Usage of `Math.Atanh()`
39+
40+
The following example demonstrates the basic usage of `Math.Atanh()`:
41+
42+
```cs
43+
using System;
44+
45+
class Program
46+
{
47+
static void Main()
48+
{
49+
double value = 0.5;
50+
double result = Math.Atanh(value);
51+
Console.WriteLine($"Atanh({value}) = {result}");
52+
}
53+
}
54+
```
55+
56+
This will output:
57+
58+
```shell
59+
Atanh(0.5) = 0.5493061443340548
60+
```
61+
62+
## Codebyte Example
63+
64+
In this example, different values are passed to `Math.Atanh()` to observe how the result changes:
65+
66+
```codebyte/csharp
67+
using System;
68+
69+
class Program
70+
{
71+
static void Main()
72+
{
73+
double[] testValues = { 0.25, 0.5, 0.75, 0.9, -0.5 };
74+
75+
foreach (double value in testValues)
76+
{
77+
double result = Math.Atanh(value);
78+
Console.WriteLine($"Atanh({value}) = {result:F4}");
79+
}
80+
}
81+
}
82+
```

0 commit comments

Comments
 (0)