From 08d0be5aa5822c4d9544baa3f140ced3508bd61b Mon Sep 17 00:00:00 2001 From: Priyansh Jain Date: Tue, 11 Nov 2025 12:32:06 +0530 Subject: [PATCH 1/3] 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 --- .../math-functions/terms/atanh/atanh.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 content/c-sharp/concepts/math-functions/terms/atanh/atanh.md diff --git a/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md new file mode 100644 index 00000000000..692ae10189a --- /dev/null +++ b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md @@ -0,0 +1,82 @@ +--- +Title: 'Atanh()' +Description: 'Returns the inverse hyperbolic tangent of a number.' +Subjects: + - 'Computer Science' + - 'Code Foundations' +Tags: + - 'Methods' + - 'Numbers' + - 'Arithmetic' +CatalogContent: + - 'learn-c-sharp' + - 'paths/computer-science' +--- + +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. + +## Syntax + +```pseudo +Math.Atanh(value); +``` + +The `Math.Atanh()` method takes one parameter: + +- `value`: A double-precision floating-point number in the range -1 to 1, representing the hyperbolic tangent value. + +The method returns: +- A double-precision floating-point number representing the inverse hyperbolic tangent of `value` in radians. +- `Double.NaN` if the value is less than -1 or greater than 1. +- `Double.NegativeInfinity` if the value equals -1. +- `Double.PositiveInfinity` if the value equals 1. + +## Example + +The following example demonstrates the use of the `Math.Atanh()` method: + +```cs +using System; + +class AtanhExample +{ + static void Main() + { + // Calculate inverse hyperbolic tangent for various values + double value1 = 0.5; + double value2 = -0.5; + double value3 = 0; + + Console.WriteLine($"Atanh({value1}) = {Math.Atanh(value1)}"); + Console.WriteLine($"Atanh({value2}) = {Math.Atanh(value2)}"); + Console.WriteLine($"Atanh({value3}) = {Math.Atanh(value3)}"); + + // Edge cases + Console.WriteLine($"Atanh(1) = {Math.Atanh(1)}"); + Console.WriteLine($"Atanh(-1) = {Math.Atanh(-1)}"); + Console.WriteLine($"Atanh(2) = {Math.Atanh(2)}"); + } +} +``` + +## Codebyte Example + +The following example is runnable and shows how `Math.Atanh()` behaves with different input values: + +```codebyte/csharp +using System; + +class Program +{ + static void Main() + { + double[] testValues = { 0.25, 0.5, 0.75, 0.9, -0.5 }; + + foreach (double value in testValues) + { + double result = Math.Atanh(value); + Console.WriteLine($"Atanh({value}) = {result:F4}"); + } + } +} +``` From 3b9d26ac462e8e7d377c035c05f93fee20f74c21 Mon Sep 17 00:00:00 2001 From: Priyansh Jain Date: Tue, 11 Nov 2025 15:06:31 +0530 Subject: [PATCH 2/3] fix: correct formatting and spacing in atanh.md --- .../math-functions/terms/atanh/atanh.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md index 692ae10189a..9076f1225f0 100644 --- a/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md +++ b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md @@ -25,40 +25,41 @@ The `Math.Atanh()` method takes one parameter: - `value`: A double-precision floating-point number in the range -1 to 1, representing the hyperbolic tangent value. -The method returns: -- A double-precision floating-point number representing the inverse hyperbolic tangent of `value` in radians. -- `Double.NaN` if the value is less than -1 or greater than 1. -- `Double.NegativeInfinity` if the value equals -1. -- `Double.PositiveInfinity` if the value equals 1. +## Return Value + +The `Math.Atanh()` method returns: + +- The inverse hyperbolic tangent of the `value` as a `double`. +- `NaN` (Not a Number) if the `value` is less than -1 or greater than 1. +- `NegativeInfinity` if the `value` is exactly -1. +- `PositiveInfinity` if the `value` is exactly 1. ## Example -The following example demonstrates the use of the `Math.Atanh()` method: +### Basic Example + +The following example demonstrates the basic usage of `Math.Atanh()`: -```cs +```codebyte/csharp using System; -class AtanhExample +class Program { - static void Main() - { - // Calculate inverse hyperbolic tangent for various values - double value1 = 0.5; - double value2 = -0.5; - double value3 = 0; - - Console.WriteLine($"Atanh({value1}) = {Math.Atanh(value1)}"); - Console.WriteLine($"Atanh({value2}) = {Math.Atanh(value2)}"); - Console.WriteLine($"Atanh({value3}) = {Math.Atanh(value3)}"); - - // Edge cases - Console.WriteLine($"Atanh(1) = {Math.Atanh(1)}"); - Console.WriteLine($"Atanh(-1) = {Math.Atanh(-1)}"); - Console.WriteLine($"Atanh(2) = {Math.Atanh(2)}"); - } + static void Main() + { + double value = 0.5; + double result = Math.Atanh(value); + Console.WriteLine($"Atanh({value}) = {result}"); + } } ``` +This will output: + +```shell +Atanh(0.5) = 0.5493061443340549 +``` + ## Codebyte Example The following example is runnable and shows how `Math.Atanh()` behaves with different input values: @@ -68,15 +69,15 @@ using System; class Program { - static void Main() + static void Main() + { + double[] testValues = { 0.25, 0.5, 0.75, 0.9, -0.5 }; + + foreach (double value in testValues) { - double[] testValues = { 0.25, 0.5, 0.75, 0.9, -0.5 }; - - foreach (double value in testValues) - { - double result = Math.Atanh(value); - Console.WriteLine($"Atanh({value}) = {result:F4}"); - } + double result = Math.Atanh(value); + Console.WriteLine($"Atanh({value}) = {result:F4}"); } + } } ``` From ca4062227e8084a65b6c55a86dfba050a988a850 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Thu, 13 Nov 2025 14:42:03 +0530 Subject: [PATCH 3/3] minor content fixes --- .../math-functions/terms/atanh/atanh.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md index 9076f1225f0..b432f63d3e4 100644 --- a/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md +++ b/content/c-sharp/concepts/math-functions/terms/atanh/atanh.md @@ -5,9 +5,9 @@ Subjects: - 'Computer Science' - 'Code Foundations' Tags: + - 'Arithmetic' - 'Methods' - 'Numbers' - - 'Arithmetic' CatalogContent: - 'learn-c-sharp' - 'paths/computer-science' @@ -21,26 +21,25 @@ The **`Math.Atanh()`** method returns the inverse hyperbolic tangent (hyperbolic Math.Atanh(value); ``` -The `Math.Atanh()` method takes one parameter: +**Parameters:** - `value`: A double-precision floating-point number in the range -1 to 1, representing the hyperbolic tangent value. -## Return Value +**Return value:** + +The `Math.Atanh()` method returns the inverse hyperbolic tangent of the given `value` as a `double`. -The `Math.Atanh()` method returns: +It returns: -- The inverse hyperbolic tangent of the `value` as a `double`. - `NaN` (Not a Number) if the `value` is less than -1 or greater than 1. - `NegativeInfinity` if the `value` is exactly -1. - `PositiveInfinity` if the `value` is exactly 1. -## Example - -### Basic Example +## Example: Basic Usage of `Math.Atanh()` The following example demonstrates the basic usage of `Math.Atanh()`: -```codebyte/csharp +```cs using System; class Program @@ -57,12 +56,12 @@ class Program This will output: ```shell -Atanh(0.5) = 0.5493061443340549 +Atanh(0.5) = 0.5493061443340548 ``` ## Codebyte Example -The following example is runnable and shows how `Math.Atanh()` behaves with different input values: +In this example, different values are passed to `Math.Atanh()` to observe how the result changes: ```codebyte/csharp using System;