Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Rust – Expected at least one digit in exponent

I am writing a physics-based Rust project using Clippy as the analysis tool, and have the following code:

const G: f64 = 6.67430e-11;
const C: i32 = 299792458;
const PLANK_CONSTANT: f64 = 6.62607015e−34; // error

The error states that I should have at least one digit in the exponent, but as you can see there are many digits. I have tried removing the decimal place, adding spaces, but it still gives the error, even though it doesn’t give the error for the variable G.

The full error if it helps:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Expected at least one digit in exponent. '(', '+', '-', ';', or '[' expected, got '−'. Unknown start of token: \u{2212}

I feel like I am missing something stupid but I have read my code many times!

>Solution :

const G: f64 = 6.67430e-11;
const C: i32 = 299792458;
const PLANK_CONSTANT: f64 = 6.62607015e-34;

Surprise, it works 🙂

I’ve just replaced (a dash) with - (a minus).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading