Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
ef4773c3
R
runtime
项目概览
dotNET Platform
/
runtime
11 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ef4773c3
编写于
3月 27, 2022
作者:
B
Bar Arnon
提交者:
GitHub
3月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add reciprocal and SinCos methods to IFloatingPoint (#59521)
上级
20761d0b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
0 deletion
+58
-0
src/libraries/System.Private.CoreLib/src/System/Double.cs
src/libraries/System.Private.CoreLib/src/System/Double.cs
+9
-0
src/libraries/System.Private.CoreLib/src/System/Half.cs
src/libraries/System.Private.CoreLib/src/System/Half.cs
+13
-0
src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs
...aries/System.Private.CoreLib/src/System/IFloatingPoint.cs
+15
-0
src/libraries/System.Private.CoreLib/src/System/Single.cs
src/libraries/System.Private.CoreLib/src/System/Single.cs
+9
-0
src/libraries/System.Runtime/ref/System.Runtime.cs
src/libraries/System.Runtime/ref/System.Runtime.cs
+12
-0
未找到文件。
src/libraries/System.Private.CoreLib/src/System/Double.cs
浏览文件 @
ef4773c3
...
...
@@ -676,6 +676,12 @@ public static TInteger ILogB<TInteger>(double x)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Pow(TSelf, TSelf)" />
public
static
double
Pow
(
double
x
,
double
y
)
=>
Math
.
Pow
(
x
,
y
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalEstimate(TSelf)" />
public
static
double
ReciprocalEstimate
(
double
x
)
=>
Math
.
ReciprocalEstimate
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalSqrtEstimate(TSelf)" />
public
static
double
ReciprocalSqrtEstimate
(
double
x
)
=>
Math
.
ReciprocalSqrtEstimate
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.Round(TSelf)" />
public
static
double
Round
(
double
x
)
=>
Math
.
Round
(
x
);
...
...
@@ -697,6 +703,9 @@ public static double ScaleB<TInteger>(double x, TInteger n)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sin(TSelf)" />
public
static
double
Sin
(
double
x
)
=>
Math
.
Sin
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.SinCos(TSelf)" />
public
static
(
double
Sin
,
double
Cos
)
SinCos
(
double
x
)
=>
Math
.
SinCos
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sinh(TSelf)" />
public
static
double
Sinh
(
double
x
)
=>
Math
.
Sinh
(
x
);
...
...
src/libraries/System.Private.CoreLib/src/System/Half.cs
浏览文件 @
ef4773c3
...
...
@@ -899,6 +899,12 @@ public static TInteger ILogB<TInteger>(Half x)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Pow(TSelf, TSelf)" />
public
static
Half
Pow
(
Half
x
,
Half
y
)
=>
(
Half
)
MathF
.
Pow
((
float
)
x
,
(
float
)
y
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalEstimate(TSelf)" />
public
static
Half
ReciprocalEstimate
(
Half
x
)
=>
(
Half
)
MathF
.
ReciprocalEstimate
((
float
)
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalSqrtEstimate(TSelf)" />
public
static
Half
ReciprocalSqrtEstimate
(
Half
x
)
=>
(
Half
)
MathF
.
ReciprocalSqrtEstimate
((
float
)
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.Round(TSelf)" />
public
static
Half
Round
(
Half
x
)
=>
(
Half
)
MathF
.
Round
((
float
)
x
);
...
...
@@ -920,6 +926,13 @@ public static Half ScaleB<TInteger>(Half x, TInteger n)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sin(TSelf)" />
public
static
Half
Sin
(
Half
x
)
=>
(
Half
)
MathF
.
Sin
((
float
)
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.SinCos(TSelf)" />
public
static
(
Half
Sin
,
Half
Cos
)
SinCos
(
Half
x
)
{
var
(
sin
,
cos
)
=
MathF
.
SinCos
((
float
)
x
);
return
((
Half
)
sin
,
(
Half
)
cos
);
}
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sinh(TSelf)" />
public
static
Half
Sinh
(
Half
x
)
=>
(
Half
)
MathF
.
Sinh
((
float
)
x
);
...
...
src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs
浏览文件 @
ef4773c3
...
...
@@ -215,6 +215,16 @@ public interface IFloatingPoint<TSelf>
/// <returns><see cref="E" /> raised to the power of <paramref name="x" />.</returns>
static
abstract
TSelf
Pow
(
TSelf
x
,
TSelf
y
);
/// <summary>Computes an estimate of the reciprocal of a value.</summary>
/// <param name="x">The value whose estimate of the reciprocal is to be computed.</param>
/// <returns>An estimate of the reciprocal of <paramref name="x" />.</returns>
static
abstract
TSelf
ReciprocalEstimate
(
TSelf
x
);
/// <summary>Computes an estimate of the reciprocal square root of a value.</summary>
/// <param name="x">The value whose estimate of the reciprocal square root is to be computed.</param>
/// <returns>An estimate of the reciprocal square root of <paramref name="x" />.</returns>
static
abstract
TSelf
ReciprocalSqrtEstimate
(
TSelf
x
);
/// <summary>Rounds a value to the nearest integer using the default rounding mode (<see cref="MidpointRounding.ToEven" />).</summary>
/// <param name="x">The value to round.</param>
/// <returns>The result of rounding <paramref name="x" /> to the nearest integer using the default rounding mode.</returns>
...
...
@@ -253,6 +263,11 @@ public interface IFloatingPoint<TSelf>
/// <returns>The sine of <paramref name="x" />.</returns>
static
abstract
TSelf
Sin
(
TSelf
x
);
/// <summary>Computes the sine and cosine of a value.</summary>
/// <param name="x">The value, in radians, whose sine and cosine are to be computed.</param>
/// <returns>The sine and cosine of <paramref name="x" />.</returns>
static
abstract
(
TSelf
Sin
,
TSelf
Cos
)
SinCos
(
TSelf
x
);
/// <summary>Computes the hyperbolic sine of a value.</summary>
/// <param name="x">The value, in radians, whose hyperbolic sine is to be computed.</param>
/// <returns>The hyperbolic sine of <paramref name="x" />.</returns>
...
...
src/libraries/System.Private.CoreLib/src/System/Single.cs
浏览文件 @
ef4773c3
...
...
@@ -671,6 +671,12 @@ public static TInteger ILogB<TInteger>(float x)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Pow(TSelf, TSelf)" />
public
static
float
Pow
(
float
x
,
float
y
)
=>
MathF
.
Pow
(
x
,
y
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalEstimate(TSelf)" />
public
static
float
ReciprocalEstimate
(
float
x
)
=>
MathF
.
ReciprocalEstimate
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.ReciprocalSqrtEstimate(TSelf)" />
public
static
float
ReciprocalSqrtEstimate
(
float
x
)
=>
MathF
.
ReciprocalSqrtEstimate
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.Round(TSelf)" />
public
static
float
Round
(
float
x
)
=>
MathF
.
Round
(
x
);
...
...
@@ -692,6 +698,9 @@ public static float ScaleB<TInteger>(float x, TInteger n)
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sin(TSelf)" />
public
static
float
Sin
(
float
x
)
=>
MathF
.
Sin
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.SinCos(TSelf)" />
public
static
(
float
Sin
,
float
Cos
)
SinCos
(
float
x
)
=>
MathF
.
SinCos
(
x
);
/// <inheritdoc cref="IFloatingPoint{TSelf}.Sinh(TSelf)" />
public
static
float
Sinh
(
float
x
)
=>
MathF
.
Sinh
(
x
);
...
...
src/libraries/System.Runtime/ref/System.Runtime.cs
浏览文件 @
ef4773c3
...
...
@@ -2070,6 +2070,8 @@ public partial class DivideByZeroException : System.ArithmeticException
public static System.Double Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Double Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.Double Pow(System.Double x, System.Double y) { throw null; }
public static System.Double ReciprocalEstimate(System.Double x) { throw null; }
public static System.Double ReciprocalSqrtEstimate(System.Double x) { throw null; }
public static System.Double Round(System.Double x) { throw null; }
public static System.Double Round(System.Double x, System.MidpointRounding mode) { throw null; }
public static System.Double Round<TInteger>(System.Double x, TInteger digits) where TInteger : IBinaryInteger<TInteger> { throw null; }
...
...
@@ -2077,6 +2079,7 @@ public partial class DivideByZeroException : System.ArithmeticException
public static System.Double ScaleB<TInteger>(System.Double x, TInteger n) where TInteger : IBinaryInteger<TInteger> { throw null; }
public static System.Double Sign(System.Double value) { throw null; }
public static System.Double Sin(System.Double x) { throw null; }
public static (System.Double Sin, System.Double Cos) SinCos(System.Double x) { throw null; }
public static System.Double Sinh(System.Double x) { throw null; }
public static System.Double Sqrt(System.Double x) { throw null; }
static System.Double System.IAdditionOperators<System.Double,System.Double,System.Double>.operator +(System.Double left, System.Double right) { throw null; }
...
...
@@ -2649,6 +2652,8 @@ public partial class GopherStyleUriParser : System.UriParser
public static System.Half Parse(string s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Half Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.Half Pow(System.Half x, System.Half y) { throw null; }
public static System.Half ReciprocalEstimate(System.Half x) { throw null; }
public static System.Half ReciprocalSqrtEstimate(System.Half x) { throw null; }
public static System.Half Round(System.Half x) { throw null; }
public static System.Half Round(System.Half x, System.MidpointRounding mode) { throw null; }
public static System.Half Round<TInteger>(System.Half x, TInteger digits) where TInteger : IBinaryInteger<TInteger> { throw null; }
...
...
@@ -2656,6 +2661,7 @@ public partial class GopherStyleUriParser : System.UriParser
public static System.Half ScaleB<TInteger>(System.Half x, TInteger n) where TInteger : IBinaryInteger<TInteger> { throw null; }
public static System.Half Sign(System.Half value) { throw null; }
public static System.Half Sin(System.Half x) { throw null; }
public static (System.Half Sin, System.Half Cos) SinCos(System.Half x) { throw null; }
public static System.Half Sinh(System.Half x) { throw null; }
public static System.Half Sqrt(System.Half x) { throw null; }
static System.Half System.IBitwiseOperators<System.Half,System.Half,System.Half>.operator &(System.Half left, System.Half right) { throw null; }
...
...
@@ -2810,12 +2816,15 @@ public partial interface IFloatingPoint<TSelf> : System.ISignedNumber<TSelf>
static abstract TSelf MaxMagnitude(TSelf x, TSelf y);
static abstract TSelf MinMagnitude(TSelf x, TSelf y);
static abstract TSelf Pow(TSelf x, TSelf y);
static abstract TSelf ReciprocalEstimate(TSelf x);
static abstract TSelf ReciprocalSqrtEstimate(TSelf x);
static abstract TSelf Round(TSelf x);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Round(TSelf x, MidpointRounding mode);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits, MidpointRounding mode) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf ScaleB<TInteger>(TSelf x, TInteger n) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Sin(TSelf x);
static abstract (TSelf Sin, TSelf Cos) SinCos(TSelf x);
static abstract TSelf Sinh(TSelf x);
static abstract TSelf Sqrt(TSelf x);
static abstract TSelf Tan(TSelf x);
...
...
@@ -4369,6 +4378,8 @@ public sealed partial class SerializableAttribute : System.Attribute
public static System.Single Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Single Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.Single Pow(System.Single x, System.Single y) { throw null; }
public static System.Single ReciprocalEstimate(System.Single x) { throw null; }
public static System.Single ReciprocalSqrtEstimate(System.Single x) { throw null; }
public static System.Single Round(System.Single x) { throw null; }
public static System.Single Round(System.Single x, System.MidpointRounding mode) { throw null; }
public static System.Single Round<TInteger>(System.Single x, TInteger digits) where TInteger : IBinaryInteger<TInteger> { throw null; }
...
...
@@ -4376,6 +4387,7 @@ public sealed partial class SerializableAttribute : System.Attribute
public static System.Single ScaleB<TInteger>(System.Single x, TInteger n) where TInteger : IBinaryInteger<TInteger> { throw null; }
public static System.Single Sign(System.Single value) { throw null; }
public static System.Single Sin(System.Single x) { throw null; }
public static (System.Single Sin, System.Single Cos) SinCos(System.Single x) { throw null; }
public static System.Single Sinh(System.Single x) { throw null; }
public static System.Single Sqrt(System.Single x) { throw null; }
static System.Single System.IAdditionOperators<System.Single,System.Single,System.Single>.operator +(System.Single left, System.Single right) { throw null; }
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录