Given the following code:
println!("{}", (3.).recip());
The current output is:
error[E0689]: can't call method `recip` on ambiguous numeric type `{float}`
--> src/main.rs:2:25
|
2 | println!("{}", (3.).recip());
| ^^^^^
|
help: you must specify a concrete type for this numeric value, like `f32`
|
2 | println!("{}", (3._f32).recip());
| ~~~~~~
For more information about this error, try `rustc --explain E0689`.
However, this won't compile, since rustc doesn't accept 3._f32 as a floating-point literal. The help should add the implied 0 for us:
2 | println!("{}", (3.0_f32).recip());
| ~~~~~~~
See also #51874, a similar issue which was fixed.
Given the following code:
The current output is:
However, this won't compile, since rustc doesn't accept
3._f32as a floating-point literal. Thehelpshould add the implied0for us:See also #51874, a similar issue which was fixed.