Practical Astronomy Algorithms in .NET/C#
Loading...
Searching...
No Matches
MathExtensions.cs
Go to the documentation of this file.
1using System;
2
3namespace PALib.Helpers;
4
8public static class MathExtensions
9{
15 public static double ACosine(this double d)
16 {
17 return Math.Acos(d);
18 }
19
25 public static double AngleTangent(this double d)
26 {
27 return Math.Atan(d);
28 }
29
36 public static double AngleTangent2(this double y, double x)
37 {
38 return Math.Atan2(y, x);
39 }
40
46 public static double ASine(this double d)
47 {
48 return Math.Asin(d);
49 }
50
54 public static double Cosine(this double d)
55 {
56 return Math.Cos(d);
57 }
58
64 public static double Floor(this double d)
65 {
66 return Math.Floor(d);
67 }
68
74 public static double Log10(this double d)
75 {
76 return Math.Log10(d);
77
78 }
79
83 public static double Sine(this double a)
84 {
85 return Math.Sin(a);
86 }
87
93 public static double SquareRoot(this double d)
94 {
95 return Math.Sqrt(d);
96 }
97
103 public static double Tangent(this double a)
104 {
105 return Math.Tan(a);
106 }
107
113 public static double ToDegrees(this double radians)
114 {
115 return radians * Math.PI / 180;
116 }
117
123 public static double ToRadians(this double degrees)
124 {
125 return degrees * (Math.PI / 180);
126 }
127}
Extension methods for mathematical calculations.
static double Floor(this double d)
Returns the largest integral value less than or equal to the specified double-precision floating-poin...
static double ToDegrees(this double radians)
Convert radians to degrees.
static double AngleTangent(this double d)
Returns the angle whose tangent is the specified number.
static double Log10(this double d)
Returns the base 10 logarithm of a specified number.
static double Cosine(this double d)
Returns the cosine of the specified angle.
static double ToRadians(this double degrees)
Convert degrees to radians.
static double AngleTangent2(this double y, double x)
Returns the angle whose tangent is the quotient of two specified numbers.
static double Sine(this double a)
Returns the sine of the specified angle.
static double Tangent(this double a)
Returns the tangent of the specified angle. ///.
static double ACosine(this double d)
Returns the angle whose cosine is the specified number.
static double SquareRoot(this double d)
Returns the square root of a specified number.
static double ASine(this double d)
Returns the angle whose sine is the specified number.