Uh oh!
There was an error while loading. Please reload this page.
Correct fns exp2 that were calling exp - #22076
Conversation
rust-highfive
commented
Feb 8, 2015
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
huonw
commented
Feb 8, 2015
Nice catch! It seem like all of these functions should have some basic tests to protect against issues like this, a few have such tests (e.g. If you're feeling energetic it would be great to add some tests for some of the other functions, but this is definitely not necessary in this patch. |
carols10cents
commented
Feb 8, 2015
@huonw I've added some tests for |
mdinger
commented
Feb 8, 2015
Ug. See #22030 which is documenting float. Sounds like you're working on the same thing. Probably don't want to be duplicating each others work...Maybe we should check to see if one has better examples... |
carols10cents
commented
Feb 8, 2015
@mdinger I didn't get too far with the documentation, I stopped when I hit this bug, so you've got better examples for the docs. It's so funny that we both found this within hours!!! |
mdinger
commented
Feb 8, 2015
Agreed. FYI, I'm working from the top down so if you decide to submit a PR against it, start at the bottom and work up. I typically only do a few examples day so it may take a few more days to finish. Then I have to test it. |
huonw
commented
Feb 11, 2015
@bors r+ 8379 Thanks |
bors
commented
Feb 11, 2015
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.bors
commented
Feb 11, 2015
Building on #22076, I've added some tests for stable methods in f32 and f64 that didn't have any before. Please let me know if there are any improvements I can make, and I am happy to make them! 📬
Building on rust-lang#22076, I've added some tests for stable methods in f32 and f64 that didn't have any before. Please let me know if there are any improvements I can make, and I am happy to make them! 📬
Fixes#22080.
I was working on adding examples to the documentation in
std::num::Float. I got toexp2, which says "Returns 2 raised to the power of the number,2^(self)."So I tried running this code:
and it resulted in a failure of
(left:32, right:148.413159). That 148.413159 is the value for e^5, which isexp(), notexp2().Sure enough,
exp2is callingexpand 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.