Open
Description
I would expect 2.0.sqrt()
to return sqrt(2) as a f64. Instead,
<anon>:9:13: 9:19 error: type `_` does not implement any method in scope named `sqrt`
<anon>:9 2.0.sqrt()
<anon>:9:19: 9:19 help: methods from traits can only be called if the trait is in scope; the following traits are implemented but not in scope, perhaps add a `use` for one of them:
<anon>:9:19: 9:19 help: candidate #1: use `std::num::Float`
<anon>:9:19: 9:19 help: candidate #2: use `core::num::Float`
... and the Float trait is deprecated!
This also occurs with integer literals.
I ran into this in the wild while doing an exponential decay:
let k = c * 2.0.powf(-1.0 * scale * dt);
A workaround is to annotate the literal's type explicitly.