提交 3b04e91d 编写于 作者: T Tomasz Różański

Change code formatting for readability.

上级 49dce293
......@@ -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);
/// ```
......
......@@ -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);
/// ```
......
......@@ -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);
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册