rust-exercises icon indicating copy to clipboard operation
rust-exercises copied to clipboard

Shapes: Add warning about order dependence in multiplication with PI

Open amanjeev opened this issue 1 year ago • 0 comments

In Shapes the Circle area requires PI which in the solution uses PI at the end. But if you change the order

std::f32::consts::PI.into() * self.radius * self.radius 

This does not work because the compiler fails to infer the type and you need explicit conversion first.

amanjeev avatar Aug 25 '23 14:08 amanjeev