Adding support for Acosh, Asinh, Atanh, and Cbrt to Math and MathF
authorTanner Gooding <tagoo@outlook.com>
Sat, 9 Dec 2017 17:53:51 +0000 (09:53 -0800)
committerTanner Gooding <tagoo@outlook.com>
Wed, 13 Dec 2017 18:37:55 +0000 (10:37 -0800)
src/classlibnative/float/floatdouble.cpp
src/classlibnative/float/floatsingle.cpp
src/classlibnative/inc/floatdouble.h
src/classlibnative/inc/floatsingle.h
src/mscorlib/src/System/Math.CoreCLR.cs
src/mscorlib/src/System/MathF.CoreCLR.cs
src/vm/ecalllist.h

index f554082..5911901 100644 (file)
@@ -60,6 +60,15 @@ FCIMPL1_V(double, COMDouble::Acos, double x)
     return (double)acos(x);
 FCIMPLEND
 
+/*=====================================Acosh====================================
+**
+==============================================================================*/
+FCIMPL1_V(double, COMDouble::Acosh, double x)
+    FCALL_CONTRACT;
+
+    return (double)acosh(x);
+FCIMPLEND
+
 /*=====================================Asin=====================================
 **
 ==============================================================================*/
@@ -69,6 +78,15 @@ FCIMPL1_V(double, COMDouble::Asin, double x)
     return (double)asin(x);
 FCIMPLEND
 
+/*=====================================Asinh====================================
+**
+==============================================================================*/
+FCIMPL1_V(double, COMDouble::Asinh, double x)
+    FCALL_CONTRACT;
+
+    return (double)asinh(x);
+FCIMPLEND
+
 /*=====================================Atan=====================================
 **
 ==============================================================================*/
@@ -78,6 +96,15 @@ FCIMPL1_V(double, COMDouble::Atan, double x)
     return (double)atan(x);
 FCIMPLEND
 
+/*=====================================Atanh====================================
+**
+==============================================================================*/
+FCIMPL1_V(double, COMDouble::Atanh, double x)
+    FCALL_CONTRACT;
+
+    return (double)atanh(x);
+FCIMPLEND
+
 /*=====================================Atan2====================================
 **
 ==============================================================================*/
@@ -87,6 +114,15 @@ FCIMPL2_VV(double, COMDouble::Atan2, double y, double x)
     return (double)atan2(y, x);
 FCIMPLEND
 
+/*====================================Cbrt======================================
+**
+==============================================================================*/
+FCIMPL1_V(double, COMDouble::Cbrt, double x)
+    FCALL_CONTRACT;
+
+    return (double)cbrt(x);
+FCIMPLEND
+
 /*====================================Ceil======================================
 **
 ==============================================================================*/
index b561747..0be1ad7 100644 (file)
@@ -58,6 +58,15 @@ FCIMPL1_V(float, COMSingle::Acos, float x)
     return (float)acosf(x);
 FCIMPLEND
 
+/*=====================================Acosh====================================
+**
+==============================================================================*/
+FCIMPL1_V(float, COMSingle::Acosh, float x)
+    FCALL_CONTRACT;
+
+    return (float)acoshf(x);
+FCIMPLEND
+
 /*=====================================Asin=====================================
 **
 ==============================================================================*/
@@ -67,6 +76,15 @@ FCIMPL1_V(float, COMSingle::Asin, float x)
     return (float)asinf(x);
 FCIMPLEND
 
+/*=====================================Asinh====================================
+**
+==============================================================================*/
+FCIMPL1_V(float, COMSingle::Asinh, float x)
+    FCALL_CONTRACT;
+
+    return (float)asinhf(x);
+FCIMPLEND
+
 /*=====================================Atan=====================================
 **
 ==============================================================================*/
@@ -76,6 +94,15 @@ FCIMPL1_V(float, COMSingle::Atan, float x)
     return (float)atanf(x);
 FCIMPLEND
 
+/*=====================================Atanh====================================
+**
+==============================================================================*/
+FCIMPL1_V(float, COMSingle::Atanh, float x)
+    FCALL_CONTRACT;
+
+    return (float)atanhf(x);
+FCIMPLEND
+
 /*=====================================Atan2====================================
 **
 ==============================================================================*/
@@ -85,6 +112,15 @@ FCIMPL2_VV(float, COMSingle::Atan2, float y, float x)
     return (float)atan2f(y, x);
 FCIMPLEND
 
+/*====================================Cbrt======================================
+**
+==============================================================================*/
+FCIMPL1_V(float, COMSingle::Cbrt, float x)
+    FCALL_CONTRACT;
+
+    return (float)cbrtf(x);
+FCIMPLEND
+
 /*====================================Ceil======================================
 **
 ==============================================================================*/
index f7412a2..d2c819f 100644 (file)
@@ -12,9 +12,13 @@ class COMDouble {
 public:
     FCDECL1_V(static double, Abs, double x);
     FCDECL1_V(static double, Acos, double x);
+    FCDECL1_V(static double, Acosh, double x);
     FCDECL1_V(static double, Asin, double x);
+    FCDECL1_V(static double, Asinh, double x);
     FCDECL1_V(static double, Atan, double x);
+    FCDECL1_V(static double, Atanh, double x);
     FCDECL2_VV(static double, Atan2, double y, double x);
+    FCDECL1_V(static double, Cbrt, double x);
     FCDECL1_V(static double, Ceil, double x);
     FCDECL1_V(static double, Cos, double x);
     FCDECL1_V(static double, Cosh, double x);
index 0124768..a4f9cb7 100644 (file)
@@ -12,9 +12,13 @@ class COMSingle {
 public:
     FCDECL1_V(static float, Abs, float x);
     FCDECL1_V(static float, Acos, float x);
+    FCDECL1_V(static float, Acosh, float x);
     FCDECL1_V(static float, Asin, float x);
+    FCDECL1_V(static float, Asinh, float x);
     FCDECL1_V(static float, Atan, float x);
+    FCDECL1_V(static float, Atanh, float x);
     FCDECL2_VV(static float, Atan2, float y, float x);
+    FCDECL1_V(static float, Cbrt, float x);
     FCDECL1_V(static float, Ceil, float x);
     FCDECL1_V(static float, Cos, float x);
     FCDECL1_V(static float, Cosh, float x);
index 92eb5cf..e4c85f9 100644 (file)
@@ -27,17 +27,29 @@ namespace System
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern double Acos(double d);
-        
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern double Acosh(double d);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern double Asin(double d);
-        
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern double Asinh(double d);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern double Atan(double d);
-        
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern double Atan2(double y, double x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern double Atanh(double d);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern double Cbrt(double d);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern double Ceiling(double a);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
index 0e4dcee..1abc040 100644 (file)
@@ -20,15 +20,27 @@ namespace System
         public static extern float Acos(float x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern float Acosh(float x);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern float Asin(float x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern float Asinh(float x);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern float Atan(float x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern float Atan2(float y, float x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern float Atanh(float x);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern float Cbrt(float x);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern float Ceiling(float x);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
index 441796f..7e850f9 100644 (file)
@@ -624,9 +624,13 @@ FCFuncStart(gMathFuncs)
     FCIntrinsicSig("Abs", &gsig_SM_Dbl_RetDbl, COMDouble::Abs, CORINFO_INTRINSIC_Abs)
     FCIntrinsicSig("Abs", &gsig_SM_Flt_RetFlt, COMSingle::Abs, CORINFO_INTRINSIC_Abs)
     FCIntrinsic("Acos", COMDouble::Acos, CORINFO_INTRINSIC_Acos)
+    FCFuncElement("Acosh", COMDouble::Acosh)
     FCIntrinsic("Asin", COMDouble::Asin, CORINFO_INTRINSIC_Asin)
+    FCFuncElement("Asinh", COMDouble::Asinh)
     FCIntrinsic("Atan", COMDouble::Atan, CORINFO_INTRINSIC_Atan)
+    FCFuncElement("Atanh", COMDouble::Atanh)
     FCIntrinsic("Atan2", COMDouble::Atan2, CORINFO_INTRINSIC_Atan2)
+    FCFuncElement("Cbrt", COMDouble::Cbrt)
     FCIntrinsic("Ceiling", COMDouble::Ceil, CORINFO_INTRINSIC_Ceiling)
     FCIntrinsic("Cos", COMDouble::Cos, CORINFO_INTRINSIC_Cos)
     FCIntrinsic("Cosh", COMDouble::Cosh, CORINFO_INTRINSIC_Cosh)
@@ -646,9 +650,13 @@ FCFuncEnd()
 
 FCFuncStart(gMathFFuncs)
     FCIntrinsic("Acos", COMSingle::Acos, CORINFO_INTRINSIC_Acos)
+    FCFuncElement("Acosh", COMSingle::Acosh)
     FCIntrinsic("Asin", COMSingle::Asin, CORINFO_INTRINSIC_Asin)
+    FCFuncElement("Asinh", COMSingle::Asinh)
     FCIntrinsic("Atan", COMSingle::Atan, CORINFO_INTRINSIC_Atan)
+    FCFuncElement("Atanh", COMSingle::Atanh)
     FCIntrinsic("Atan2", COMSingle::Atan2, CORINFO_INTRINSIC_Atan2)
+    FCFuncElement("Cbrt", COMSingle::Cbrt)
     FCIntrinsic("Ceiling", COMSingle::Ceil, CORINFO_INTRINSIC_Ceiling)
     FCIntrinsic("Cos", COMSingle::Cos, CORINFO_INTRINSIC_Cos)
     FCIntrinsic("Cosh", COMSingle::Cosh, CORINFO_INTRINSIC_Cosh)