提交 28c9231a 编写于 作者: L Linus Färnstrand

Make libcore float constant examples similar to libstd

上级 daf8afdc
......@@ -394,9 +394,7 @@ pub fn recip(self) -> f32 {
/// Converts radians to degrees.
///
/// ```
/// use std::f32::consts;
///
/// let angle = consts::PI;
/// let angle = std::f32::consts::PI;
///
/// let abs_difference = (angle.to_degrees() - 180.0).abs();
///
......@@ -413,11 +411,9 @@ pub fn to_degrees(self) -> f32 {
/// Converts degrees to radians.
///
/// ```
/// use std::f32::consts;
///
/// let angle = 180.0f32;
///
/// let abs_difference = (angle.to_radians() - consts::PI).abs();
/// let abs_difference = (angle.to_radians() - std::f32::consts::PI).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
......
......@@ -407,9 +407,7 @@ pub fn recip(self) -> f64 {
/// Converts radians to degrees.
///
/// ```
/// use std::f64::consts;
///
/// let angle = consts::PI;
/// let angle = std::f64::consts::PI;
///
/// let abs_difference = (angle.to_degrees() - 180.0).abs();
///
......@@ -427,11 +425,9 @@ pub fn to_degrees(self) -> f64 {
/// Converts degrees to radians.
///
/// ```
/// use std::f64::consts;
///
/// let angle = 180.0_f64;
///
/// let abs_difference = (angle.to_radians() - consts::PI).abs();
/// let abs_difference = (angle.to_radians() - std::f64::consts::PI).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册