]> git.lizzy.rs Git - rust.git/commit
Auto merge of #22076 - carols10cents:exp2-calling-exp, r=huonw
authorbors <bors@rust-lang.org>
Wed, 11 Feb 2015 03:15:00 +0000 (03:15 +0000)
committerbors <bors@rust-lang.org>
Wed, 11 Feb 2015 03:15:00 +0000 (03:15 +0000)
commit5936278ed6bef736f6eb8c0dd4d650fd8e10461b
treea9dc9a5c81825e471ad7daefb59577f1de40e4ab
parent2067dd2a86c059d83377fd2ad87a579846c266e1
parent8379062be53e79e5f4dc23753c0152700d20bfac
Auto merge of #22076 - carols10cents:exp2-calling-exp, r=huonw

I was working on adding examples to the documentation in `std::num::Float`. I got to `exp2`, which says "Returns 2 raised to the power of the number, `2^(self)`."

So I tried running this code:

```
use std::num::Float;

#[test]
fn test_exp2() {
    assert_eq!(32.0, 5.0.exp2());
}
```

and it resulted in a failure of `(left: `32`, right: `148.413159`)`. That 148.413159 is the value for e^5, which is `exp()`, not `exp2()`.

Sure enough, `exp2` is calling `exp` and shouldn't be, looks like a copy-paste error.

I haven't added any tests for this since it's unlikely to break again, but I will happily do so if people think that would be a good idea. The doc examples are coming :)

I scanned through the other functions in these files for similar sorts of errors and didn't notice any.