Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3b04e91d
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,发现更多精彩内容 >>
提交
3b04e91d
编写于
8月 22, 2019
作者:
T
Tomasz Różański
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change code formatting for readability.
上级
49dce293
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
20 deletion
+20
-20
src/libcore/num/f32.rs
src/libcore/num/f32.rs
+1
-1
src/libcore/num/f64.rs
src/libcore/num/f64.rs
+1
-1
src/libstd/f32.rs
src/libstd/f32.rs
+9
-9
src/libstd/f64.rs
src/libstd/f64.rs
+9
-9
未找到文件。
src/libcore/num/f32.rs
浏览文件 @
3b04e91d
...
...
@@ -315,7 +315,7 @@ pub fn is_sign_negative(self) -> bool {
/// use std::f32;
///
/// let x = 2.0_f32;
/// let abs_difference = (x.recip() - (1.0
/
x)).abs();
/// let abs_difference = (x.recip() - (1.0
/
x)).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
src/libcore/num/f64.rs
浏览文件 @
3b04e91d
...
...
@@ -327,7 +327,7 @@ pub fn is_negative(self) -> bool {
///
/// ```
/// let x = 2.0_f64;
/// let abs_difference = (x.recip() - (1.0
/
x)).abs();
/// let abs_difference = (x.recip() - (1.0
/
x)).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
src/libstd/f32.rs
浏览文件 @
3b04e91d
...
...
@@ -236,7 +236,7 @@ pub fn copysign(self, sign: f32) -> f32 {
/// let b = 60.0_f32;
///
/// // 100.0
/// let abs_difference = (m.mul_add(x, b) - (
m*x
+ b)).abs();
/// let abs_difference = (m.mul_add(x, b) - (
(m * x)
+ b)).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
@@ -318,7 +318,7 @@ pub fn rem_euclid(self, rhs: f32) -> f32 {
/// use std::f32;
///
/// let x = 2.0_f32;
/// let abs_difference = (x.powi(2) -
x*x
).abs();
/// let abs_difference = (x.powi(2) -
(x * x)
).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
@@ -336,7 +336,7 @@ pub fn powi(self, n: i32) -> f32 {
/// use std::f32;
///
/// let x = 2.0_f32;
/// let abs_difference = (x.powf(2.0) -
x*x
).abs();
/// let abs_difference = (x.powf(2.0) -
(x * x)
).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
...
...
@@ -623,7 +623,7 @@ pub fn sin(self) -> f32 {
/// ```
/// use std::f32;
///
/// let x = 2.0
*
f32::consts::PI;
/// let x = 2.0
*
f32::consts::PI;
///
/// let abs_difference = (x.cos() - 1.0).abs();
///
...
...
@@ -745,8 +745,8 @@ pub fn atan(self) -> f32 {
/// let x2 = -3.0f32;
/// let y2 = 3.0f32;
///
/// let abs_difference_1 = (y1.atan2(x1) - (-pi
/
4.0)).abs();
/// let abs_difference_2 = (y2.atan2(x2) -
3.0*pi/4.0
).abs();
/// let abs_difference_1 = (y1.atan2(x1) - (-pi
/
4.0)).abs();
/// let abs_difference_2 = (y2.atan2(x2) -
(3.0 * pi / 4.0)
).abs();
///
/// assert!(abs_difference_1 <= f32::EPSILON);
/// assert!(abs_difference_2 <= f32::EPSILON);
...
...
@@ -834,7 +834,7 @@ pub fn ln_1p(self) -> f32 {
///
/// let f = x.sinh();
/// // Solving sinh() at 1 gives `(e^2-1)/(2e)`
/// let g = (
e*e - 1.0)/(2.0*
e);
/// let g = (
(e * e) - 1.0) / (2.0 *
e);
/// let abs_difference = (f - g).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
...
...
@@ -856,7 +856,7 @@ pub fn sinh(self) -> f32 {
/// let x = 1.0f32;
/// let f = x.cosh();
/// // Solving cosh() at 1 gives this result
/// let g = (
e*e + 1.0)/(2.0*
e);
/// let g = (
(e * e) + 1.0) / (2.0 *
e);
/// let abs_difference = (f - g).abs();
///
/// // Same result
...
...
@@ -880,7 +880,7 @@ pub fn cosh(self) -> f32 {
///
/// let f = x.tanh();
/// // Solving tanh() at 1 gives `(1 - e^(-2))/(1 + e^(-2))`
/// let g = (1.0 - e.powi(-2))
/
(1.0 + e.powi(-2));
/// let g = (1.0 - e.powi(-2))
/
(1.0 + e.powi(-2));
/// let abs_difference = (f - g).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
...
...
src/libstd/f64.rs
浏览文件 @
3b04e91d
...
...
@@ -212,7 +212,7 @@ pub fn copysign(self, sign: f64) -> f64 {
/// let b = 60.0_f64;
///
/// // 100.0
/// let abs_difference = (m.mul_add(x, b) - (
m*x
+ b)).abs();
/// let abs_difference = (m.mul_add(x, b) - (
(m * x)
+ b)).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
@@ -291,7 +291,7 @@ pub fn rem_euclid(self, rhs: f64) -> f64 {
///
/// ```
/// let x = 2.0_f64;
/// let abs_difference = (x.powi(2) -
x*x
).abs();
/// let abs_difference = (x.powi(2) -
(x * x)
).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
@@ -307,7 +307,7 @@ pub fn powi(self, n: i32) -> f64 {
///
/// ```
/// let x = 2.0_f64;
/// let abs_difference = (x.powf(2.0) -
x*x
).abs();
/// let abs_difference = (x.powf(2.0) -
(x * x)
).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
...
...
@@ -556,7 +556,7 @@ pub fn sin(self) -> f64 {
/// ```
/// use std::f64;
///
/// let x = 2.0
*
f64::consts::PI;
/// let x = 2.0
*
f64::consts::PI;
///
/// let abs_difference = (x.cos() - 1.0).abs();
///
...
...
@@ -672,8 +672,8 @@ pub fn atan(self) -> f64 {
/// let x2 = -3.0_f64;
/// let y2 = 3.0_f64;
///
/// let abs_difference_1 = (y1.atan2(x1) - (-pi
/
4.0)).abs();
/// let abs_difference_2 = (y2.atan2(x2) -
3.0*pi/4.0
).abs();
/// let abs_difference_1 = (y1.atan2(x1) - (-pi
/
4.0)).abs();
/// let abs_difference_2 = (y2.atan2(x2) -
(3.0 * pi / 4.0)
).abs();
///
/// assert!(abs_difference_1 < 1e-10);
/// assert!(abs_difference_2 < 1e-10);
...
...
@@ -759,7 +759,7 @@ pub fn ln_1p(self) -> f64 {
///
/// let f = x.sinh();
/// // Solving sinh() at 1 gives `(e^2-1)/(2e)`
/// let g = (
e*e - 1.0)/(2.0*
e);
/// let g = (
(e * e) - 1.0) / (2.0 *
e);
/// let abs_difference = (f - g).abs();
///
/// assert!(abs_difference < 1e-10);
...
...
@@ -781,7 +781,7 @@ pub fn sinh(self) -> f64 {
/// let x = 1.0_f64;
/// let f = x.cosh();
/// // Solving cosh() at 1 gives this result
/// let g = (
e*e + 1.0)/(2.0*
e);
/// let g = (
(e * e) + 1.0) / (2.0 *
e);
/// let abs_difference = (f - g).abs();
///
/// // Same result
...
...
@@ -805,7 +805,7 @@ pub fn cosh(self) -> f64 {
///
/// let f = x.tanh();
/// // Solving tanh() at 1 gives `(1 - e^(-2))/(1 + e^(-2))`
/// let g = (1.0 - e.powi(-2))
/
(1.0 + e.powi(-2));
/// let g = (1.0 - e.powi(-2))
/
(1.0 + e.powi(-2));
/// let abs_difference = (f - g).abs();
///
/// assert!(abs_difference < 1.0e-10);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录