Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
daf8afdc
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
daf8afdc
编写于
4月 05, 2020
作者:
L
Linus Färnstrand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove more std::f32 imports in libstd
上级
d06b26fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
78 deletion
+30
-78
src/libstd/f32.rs
src/libstd/f32.rs
+15
-39
src/libstd/f64.rs
src/libstd/f64.rs
+15
-39
未找到文件。
src/libstd/f32.rs
浏览文件 @
daf8afdc
...
...
@@ -546,9 +546,7 @@ pub fn hypot(self, other: f32) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let x = f32::consts::FRAC_PI_2;
/// let x = std::f32::consts::FRAC_PI_2;
///
/// let abs_difference = (x.sin() - 1.0).abs();
///
...
...
@@ -566,9 +564,7 @@ pub fn sin(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let x = 2.0 * f32::consts::PI;
/// let x = 2.0 * std::f32::consts::PI;
///
/// let abs_difference = (x.cos() - 1.0).abs();
///
...
...
@@ -586,9 +582,7 @@ pub fn cos(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let x = f32::consts::FRAC_PI_4;
/// let x = std::f32::consts::FRAC_PI_4;
/// let abs_difference = (x.tan() - 1.0).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
...
...
@@ -607,12 +601,10 @@ pub fn tan(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let f = f32::consts::FRAC_PI_2;
/// let f = std::f32::consts::FRAC_PI_2;
///
/// // asin(sin(pi/2))
/// let abs_difference = (f.sin().asin() - f32::consts::FRAC_PI_2).abs();
/// let abs_difference = (f.sin().asin() -
std::
f32::consts::FRAC_PI_2).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
@@ -630,12 +622,10 @@ pub fn asin(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let f = f32::consts::FRAC_PI_4;
/// let f = std::f32::consts::FRAC_PI_4;
///
/// // acos(cos(pi/4))
/// let abs_difference = (f.cos().acos() - f32::consts::FRAC_PI_4).abs();
/// let abs_difference = (f.cos().acos() -
std::
f32::consts::FRAC_PI_4).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
@@ -676,8 +666,6 @@ pub fn atan(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// // Positive angles measured counter-clockwise
/// // from positive x axis
/// // -pi/4 radians (45 deg clockwise)
...
...
@@ -688,8 +676,8 @@ pub fn atan(self) -> f32 {
/// let x2 = -3.0f32;
/// let y2 = 3.0f32;
///
/// let abs_difference_1 = (y1.atan2(x1) - (-f32::consts::FRAC_PI_4)).abs();
/// let abs_difference_2 = (y2.atan2(x2) - (3.0 * f32::consts::FRAC_PI_4)).abs();
/// let abs_difference_1 = (y1.atan2(x1) - (-
std::
f32::consts::FRAC_PI_4)).abs();
/// let abs_difference_2 = (y2.atan2(x2) - (3.0 *
std::
f32::consts::FRAC_PI_4)).abs();
///
/// assert!(abs_difference_1 <= f32::EPSILON);
/// assert!(abs_difference_2 <= f32::EPSILON);
...
...
@@ -707,9 +695,7 @@ pub fn atan2(self, other: f32) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let x = f32::consts::FRAC_PI_4;
/// let x = std::f32::consts::FRAC_PI_4;
/// let f = x.sin_cos();
///
/// let abs_difference_0 = (f.0 - x.sin()).abs();
...
...
@@ -750,9 +736,7 @@ pub fn exp_m1(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let x = f32::consts::E - 1.0;
/// let x = std::f32::consts::E - 1.0;
///
/// // ln(1 + (e - 1)) == ln(e) == 1
/// let abs_difference = (x.ln_1p() - 1.0).abs();
...
...
@@ -771,9 +755,7 @@ pub fn ln_1p(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let e = f32::consts::E;
/// let e = std::f32::consts::E;
/// let x = 1.0f32;
///
/// let f = x.sinh();
...
...
@@ -795,9 +777,7 @@ pub fn sinh(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let e = f32::consts::E;
/// let e = std::f32::consts::E;
/// let x = 1.0f32;
/// let f = x.cosh();
/// // Solving cosh() at 1 gives this result
...
...
@@ -819,9 +799,7 @@ pub fn cosh(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let e = f32::consts::E;
/// let e = std::f32::consts::E;
/// let x = 1.0f32;
///
/// let f = x.tanh();
...
...
@@ -885,9 +863,7 @@ pub fn acosh(self) -> f32 {
/// # Examples
///
/// ```
/// use std::f32;
///
/// let e = f32::consts::E;
/// let e = std::f32::consts::E;
/// let f = e.tanh().atanh();
///
/// let abs_difference = (f - e).abs();
...
...
src/libstd/f64.rs
浏览文件 @
daf8afdc
...
...
@@ -548,9 +548,7 @@ pub fn hypot(self, other: f64) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let x = f64::consts::FRAC_PI_2;
/// let x = std::f64::consts::FRAC_PI_2;
///
/// let abs_difference = (x.sin() - 1.0).abs();
///
...
...
@@ -568,9 +566,7 @@ pub fn sin(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let x = 2.0 * f64::consts::PI;
/// let x = 2.0 * std::f64::consts::PI;
///
/// let abs_difference = (x.cos() - 1.0).abs();
///
...
...
@@ -588,9 +584,7 @@ pub fn cos(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let x = f64::consts::FRAC_PI_4;
/// let x = std::f64::consts::FRAC_PI_4;
/// let abs_difference = (x.tan() - 1.0).abs();
///
/// assert!(abs_difference < 1e-14);
...
...
@@ -609,12 +603,10 @@ pub fn tan(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let f = f64::consts::FRAC_PI_2;
/// let f = std::f64::consts::FRAC_PI_2;
///
/// // asin(sin(pi/2))
/// let abs_difference = (f.sin().asin() - f64::consts::FRAC_PI_2).abs();
/// let abs_difference = (f.sin().asin() -
std::
f64::consts::FRAC_PI_2).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
@@ -632,12 +624,10 @@ pub fn asin(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let f = f64::consts::FRAC_PI_4;
/// let f = std::f64::consts::FRAC_PI_4;
///
/// // acos(cos(pi/4))
/// let abs_difference = (f.cos().acos() - f64::consts::FRAC_PI_4).abs();
/// let abs_difference = (f.cos().acos() -
std::
f64::consts::FRAC_PI_4).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
@@ -678,8 +668,6 @@ pub fn atan(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// // Positive angles measured counter-clockwise
/// // from positive x axis
/// // -pi/4 radians (45 deg clockwise)
...
...
@@ -690,8 +678,8 @@ pub fn atan(self) -> f64 {
/// let x2 = -3.0_f64;
/// let y2 = 3.0_f64;
///
/// let abs_difference_1 = (y1.atan2(x1) - (-f64::consts::FRAC_PI_4)).abs();
/// let abs_difference_2 = (y2.atan2(x2) - (3.0 * f64::consts::FRAC_PI_4)).abs();
/// let abs_difference_1 = (y1.atan2(x1) - (-
std::
f64::consts::FRAC_PI_4)).abs();
/// let abs_difference_2 = (y2.atan2(x2) - (3.0 *
std::
f64::consts::FRAC_PI_4)).abs();
///
/// assert!(abs_difference_1 < 1e-10);
/// assert!(abs_difference_2 < 1e-10);
...
...
@@ -709,9 +697,7 @@ pub fn atan2(self, other: f64) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let x = f64::consts::FRAC_PI_4;
/// let x = std::f64::consts::FRAC_PI_4;
/// let f = x.sin_cos();
///
/// let abs_difference_0 = (f.0 - x.sin()).abs();
...
...
@@ -752,9 +738,7 @@ pub fn exp_m1(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let x = f64::consts::E - 1.0;
/// let x = std::f64::consts::E - 1.0;
///
/// // ln(1 + (e - 1)) == ln(e) == 1
/// let abs_difference = (x.ln_1p() - 1.0).abs();
...
...
@@ -773,9 +757,7 @@ pub fn ln_1p(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let e = f64::consts::E;
/// let e = std::f64::consts::E;
/// let x = 1.0_f64;
///
/// let f = x.sinh();
...
...
@@ -797,9 +779,7 @@ pub fn sinh(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let e = f64::consts::E;
/// let e = std::f64::consts::E;
/// let x = 1.0_f64;
/// let f = x.cosh();
/// // Solving cosh() at 1 gives this result
...
...
@@ -821,9 +801,7 @@ pub fn cosh(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let e = f64::consts::E;
/// let e = std::f64::consts::E;
/// let x = 1.0_f64;
///
/// let f = x.tanh();
...
...
@@ -887,9 +865,7 @@ pub fn acosh(self) -> f64 {
/// # Examples
///
/// ```
/// use std::f64;
///
/// let e = f64::consts::E;
/// let e = std::f64::consts::E;
/// let f = e.tanh().atanh();
///
/// let abs_difference = (f - e).abs();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录