Skip to content

Commit

Permalink
using 2.0.log(2.0) in examples does not make it clear which is the ba…
Browse files Browse the repository at this point in the history
…se and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground.
  • Loading branch information
srinivasreddy committed Nov 6, 2019
1 parent 61a551b commit 62167c0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,10 @@ impl f64 {
/// # Examples
///
/// ```
/// let five = 5.0_f64;
/// let twenty_five = 25.0_f64;
///
/// // log5(5) - 1 == 0
/// let abs_difference = (five.log(5.0) - 1.0).abs();
/// // log5(25) - 2 == 0
/// let abs_difference = (twenty_five.log(5.0) - 2.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
Expand All @@ -425,10 +425,10 @@ impl f64 {
/// # Examples
///
/// ```
/// let two = 2.0_f64;
/// let four = 4.0_f64;
///
/// // log2(2) - 1 == 0
/// let abs_difference = (two.log2() - 1.0).abs();
/// // log2(4) - 2 == 0
/// let abs_difference = (four.log2() - 2.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
Expand All @@ -448,10 +448,10 @@ impl f64 {
/// # Examples
///
/// ```
/// let ten = 10.0_f64;
/// let hundred = 100.0_f64;
///
/// // log10(10) - 1 == 0
/// let abs_difference = (ten.log10() - 1.0).abs();
/// // log10(100) - 2 == 0
/// let abs_difference = (hundred.log10() - 2.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
Expand Down

0 comments on commit 62167c0

Please sign in to comment.