You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn main() {
let x: f64 = 2.0;
println!("{}", x / 2);
}
Returns:
expected `f64` but found `<generic integer #0>` (expected f64 but found integral variable)
Easy fix is to change the 2 to a 2.0, although that seems kind of excessive in this case. It makes more sense to make integer constants generic numbers, like Haskell does, if they're going to be generic.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Can't infer generic integer constants as floating-point
Can't infer generic integer constants as floating-point (0.11.0)
Jul 14, 2014
emberian
changed the title
Can't infer generic integer constants as floating-point (0.11.0)
Can't infer generic integer constants as floating-point
Jul 14, 2014
Returns:
Easy fix is to change the
2
to a2.0
, although that seems kind of excessive in this case. It makes more sense to make integer constants generic numbers, like Haskell does, if they're going to be generic.The text was updated successfully, but these errors were encountered: