File: src\System\Math.CoreCLR.cs
Web Access
Project: src\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj (System.Private.CoreLib)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
/*============================================================
**
**
**
** Purpose: Some floating-point math operations
**
**
===========================================================*/
 
using System.Runtime.CompilerServices;
 
namespace System
{
    public static partial class Math
    {
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Acos(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Acosh(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Asin(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Asinh(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Atan(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Atanh(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Atan2(double y, double x);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Cbrt(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Ceiling(double a);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Cos(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Cosh(double value);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Exp(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Floor(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double FusedMultiplyAdd(double x, double y, double z);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Log(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Log2(double x);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Log10(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Pow(double x, double y);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Sin(double a);
 
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static unsafe (double Sin, double Cos) SinCos(double x)
        {
            if (RuntimeHelpers.IsKnownConstant(x))
            {
                return (Sin(x), Cos(x));
            }
 
            double sin, cos;
            SinCos(x, &sin, &cos);
            return (sin, cos);
        }
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Sinh(double value);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Sqrt(double d);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Tan(double a);
 
        [Intrinsic]
        [MethodImpl(MethodImplOptions.InternalCall)]
        public static extern double Tanh(double value);
 
        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern unsafe double ModF(double x, double* intptr);
 
        [MethodImpl(MethodImplOptions.InternalCall)]
        private static extern unsafe void SinCos(double x, double* sin, double* cos);
    }
}