Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ecf4dc8

Browse files
committed
Adding support for Acosh, Asinh, Atanh, and Cbrt to Math and MathF
1 parent 1971e79 commit ecf4dc8

File tree

7 files changed

+115
-3
lines changed

7 files changed

+115
-3
lines changed

src/classlibnative/float/floatdouble.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ FCIMPL1_V(double, COMDouble::Acos, double x)
6060
return (double)acos(x);
6161
FCIMPLEND
6262

63+
/*=====================================Acosh====================================
64+
**
65+
==============================================================================*/
66+
FCIMPL1_V(double, COMDouble::Acosh, double x)
67+
FCALL_CONTRACT;
68+
69+
return (double)acosh(x);
70+
FCIMPLEND
71+
6372
/*=====================================Asin=====================================
6473
**
6574
==============================================================================*/
@@ -69,6 +78,15 @@ FCIMPL1_V(double, COMDouble::Asin, double x)
6978
return (double)asin(x);
7079
FCIMPLEND
7180

81+
/*=====================================Asinh====================================
82+
**
83+
==============================================================================*/
84+
FCIMPL1_V(double, COMDouble::Asinh, double x)
85+
FCALL_CONTRACT;
86+
87+
return (double)asinh(x);
88+
FCIMPLEND
89+
7290
/*=====================================Atan=====================================
7391
**
7492
==============================================================================*/
@@ -78,6 +96,15 @@ FCIMPL1_V(double, COMDouble::Atan, double x)
7896
return (double)atan(x);
7997
FCIMPLEND
8098

99+
/*=====================================Atanh====================================
100+
**
101+
==============================================================================*/
102+
FCIMPL1_V(double, COMDouble::Atanh, double x)
103+
FCALL_CONTRACT;
104+
105+
return (double)atanh(x);
106+
FCIMPLEND
107+
81108
/*=====================================Atan2====================================
82109
**
83110
==============================================================================*/
@@ -87,6 +114,15 @@ FCIMPL2_VV(double, COMDouble::Atan2, double y, double x)
87114
return (double)atan2(y, x);
88115
FCIMPLEND
89116

117+
/*====================================Cbrt======================================
118+
**
119+
==============================================================================*/
120+
FCIMPL1_V(double, COMDouble::Cbrt, double x)
121+
FCALL_CONTRACT;
122+
123+
return (double)cbrt(x);
124+
FCIMPLEND
125+
90126
/*====================================Ceil======================================
91127
**
92128
==============================================================================*/

src/classlibnative/float/floatsingle.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ FCIMPL1_V(float, COMSingle::Acos, float x)
5858
return (float)acosf(x);
5959
FCIMPLEND
6060

61+
/*=====================================Acosh====================================
62+
**
63+
==============================================================================*/
64+
FCIMPL1_V(float, COMSingle::Acosh, float x)
65+
FCALL_CONTRACT;
66+
67+
return (float)acoshf(x);
68+
FCIMPLEND
69+
6170
/*=====================================Asin=====================================
6271
**
6372
==============================================================================*/
@@ -67,6 +76,15 @@ FCIMPL1_V(float, COMSingle::Asin, float x)
6776
return (float)asinf(x);
6877
FCIMPLEND
6978

79+
/*=====================================Asinh====================================
80+
**
81+
==============================================================================*/
82+
FCIMPL1_V(float, COMSingle::Asinh, float x)
83+
FCALL_CONTRACT;
84+
85+
return (float)asinhf(x);
86+
FCIMPLEND
87+
7088
/*=====================================Atan=====================================
7189
**
7290
==============================================================================*/
@@ -76,6 +94,15 @@ FCIMPL1_V(float, COMSingle::Atan, float x)
7694
return (float)atanf(x);
7795
FCIMPLEND
7896

97+
/*=====================================Atanh====================================
98+
**
99+
==============================================================================*/
100+
FCIMPL1_V(float, COMSingle::Atanh, float x)
101+
FCALL_CONTRACT;
102+
103+
return (float)atanhf(x);
104+
FCIMPLEND
105+
79106
/*=====================================Atan2====================================
80107
**
81108
==============================================================================*/
@@ -85,6 +112,15 @@ FCIMPL2_VV(float, COMSingle::Atan2, float y, float x)
85112
return (float)atan2f(y, x);
86113
FCIMPLEND
87114

115+
/*====================================Cbrt======================================
116+
**
117+
==============================================================================*/
118+
FCIMPL1_V(float, COMSingle::Cbrt, float x)
119+
FCALL_CONTRACT;
120+
121+
return (float)cbrtf(x);
122+
FCIMPLEND
123+
88124
/*====================================Ceil======================================
89125
**
90126
==============================================================================*/

src/classlibnative/inc/floatdouble.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ class COMDouble {
1212
public:
1313
FCDECL1_V(static double, Abs, double x);
1414
FCDECL1_V(static double, Acos, double x);
15+
FCDECL1_V(static double, Acosh, double x);
1516
FCDECL1_V(static double, Asin, double x);
17+
FCDECL1_V(static double, Asinh, double x);
1618
FCDECL1_V(static double, Atan, double x);
19+
FCDECL1_V(static double, Atanh, double x);
1720
FCDECL2_VV(static double, Atan2, double y, double x);
21+
FCDECL1_V(static double, Cbrt, double x);
1822
FCDECL1_V(static double, Ceil, double x);
1923
FCDECL1_V(static double, Cos, double x);
2024
FCDECL1_V(static double, Cosh, double x);

src/classlibnative/inc/floatsingle.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ class COMSingle {
1212
public:
1313
FCDECL1_V(static float, Abs, float x);
1414
FCDECL1_V(static float, Acos, float x);
15+
FCDECL1_V(static float, Acosh, float x);
1516
FCDECL1_V(static float, Asin, float x);
17+
FCDECL1_V(static float, Asinh, float x);
1618
FCDECL1_V(static float, Atan, float x);
19+
FCDECL1_V(static float, Atanh, float x);
1720
FCDECL2_VV(static float, Atan2, float y, float x);
21+
FCDECL1_V(static float, Cbrt, float x);
1822
FCDECL1_V(static float, Ceil, float x);
1923
FCDECL1_V(static float, Cos, float x);
2024
FCDECL1_V(static float, Cosh, float x);

src/mscorlib/src/System/Math.CoreCLR.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,28 @@ public static partial class Math
2727

2828
[MethodImpl(MethodImplOptions.InternalCall)]
2929
public static extern double Acos(double d);
30-
30+
31+
[MethodImpl(MethodImplOptions.InternalCall)]
32+
public static extern double Acosh(double d);
33+
3134
[MethodImpl(MethodImplOptions.InternalCall)]
3235
public static extern double Asin(double d);
33-
36+
37+
[MethodImpl(MethodImplOptions.InternalCall)]
38+
public static extern double Asinh(double d);
39+
3440
[MethodImpl(MethodImplOptions.InternalCall)]
3541
public static extern double Atan(double d);
36-
42+
3743
[MethodImpl(MethodImplOptions.InternalCall)]
3844
public static extern double Atan2(double y, double x);
3945

46+
[MethodImpl(MethodImplOptions.InternalCall)]
47+
public static extern double Atanh(double d);
48+
49+
[MethodImpl(MethodImplOptions.InternalCall)]
50+
public static extern double Cbrt(double d);
51+
4052
[MethodImpl(MethodImplOptions.InternalCall)]
4153
public static extern double Ceiling(double a);
4254

src/mscorlib/src/System/MathF.CoreCLR.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,27 @@ public static partial class MathF
1919
[MethodImpl(MethodImplOptions.InternalCall)]
2020
public static extern float Acos(float x);
2121

22+
[MethodImpl(MethodImplOptions.InternalCall)]
23+
public static extern float Acosh(float x);
24+
2225
[MethodImpl(MethodImplOptions.InternalCall)]
2326
public static extern float Asin(float x);
2427

28+
[MethodImpl(MethodImplOptions.InternalCall)]
29+
public static extern float Asinh(float x);
30+
2531
[MethodImpl(MethodImplOptions.InternalCall)]
2632
public static extern float Atan(float x);
2733

2834
[MethodImpl(MethodImplOptions.InternalCall)]
2935
public static extern float Atan2(float y, float x);
3036

37+
[MethodImpl(MethodImplOptions.InternalCall)]
38+
public static extern float Atanh(float x);
39+
40+
[MethodImpl(MethodImplOptions.InternalCall)]
41+
public static extern float Cbrt(float x);
42+
3143
[MethodImpl(MethodImplOptions.InternalCall)]
3244
public static extern float Ceiling(float x);
3345

src/vm/ecalllist.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,13 @@ FCFuncStart(gMathFuncs)
624624
FCIntrinsicSig("Abs", &gsig_SM_Dbl_RetDbl, COMDouble::Abs, CORINFO_INTRINSIC_Abs)
625625
FCIntrinsicSig("Abs", &gsig_SM_Flt_RetFlt, COMSingle::Abs, CORINFO_INTRINSIC_Abs)
626626
FCIntrinsic("Acos", COMDouble::Acos, CORINFO_INTRINSIC_Acos)
627+
FCFuncElement("Acosh", COMDouble::Acosh)
627628
FCIntrinsic("Asin", COMDouble::Asin, CORINFO_INTRINSIC_Asin)
629+
FCFuncElement("Asinh", COMDouble::Asinh)
628630
FCIntrinsic("Atan", COMDouble::Atan, CORINFO_INTRINSIC_Atan)
631+
FCFuncElement("Atanh", COMDouble::Atanh)
629632
FCIntrinsic("Atan2", COMDouble::Atan2, CORINFO_INTRINSIC_Atan2)
633+
FCFuncElement("Cbrt", COMDouble::Cbrt)
630634
FCIntrinsic("Ceiling", COMDouble::Ceil, CORINFO_INTRINSIC_Ceiling)
631635
FCIntrinsic("Cos", COMDouble::Cos, CORINFO_INTRINSIC_Cos)
632636
FCIntrinsic("Cosh", COMDouble::Cosh, CORINFO_INTRINSIC_Cosh)
@@ -646,9 +650,13 @@ FCFuncEnd()
646650

647651
FCFuncStart(gMathFFuncs)
648652
FCIntrinsic("Acos", COMSingle::Acos, CORINFO_INTRINSIC_Acos)
653+
FCFuncElement("Acosh", COMSingle::Acosh)
649654
FCIntrinsic("Asin", COMSingle::Asin, CORINFO_INTRINSIC_Asin)
655+
FCFuncElement("Asinh", COMSingle::Asinh)
650656
FCIntrinsic("Atan", COMSingle::Atan, CORINFO_INTRINSIC_Atan)
657+
FCFuncElement("Atanh", COMSingle::Atanh)
651658
FCIntrinsic("Atan2", COMSingle::Atan2, CORINFO_INTRINSIC_Atan2)
659+
FCFuncElement("Cbrt", COMSingle::Cbrt)
652660
FCIntrinsic("Ceiling", COMSingle::Ceil, CORINFO_INTRINSIC_Ceiling)
653661
FCIntrinsic("Cos", COMSingle::Cos, CORINFO_INTRINSIC_Cos)
654662
FCIntrinsic("Cosh", COMSingle::Cosh, CORINFO_INTRINSIC_Cosh)

0 commit comments

Comments
 (0)