Possible to make powf const?

⚓ Rust    📅 2026-01-30    👤 surdeus    👁️ 9      

surdeus

Warning

This post was published 32 days ago. The information described in this article may have changed.

Is there a proper way to do this?

//const POWER: f64 = 1.321929_f64;
const POWER250: f64 = 3.35775061812362868504_f64; //  2.5^1.321929

I don't like magic values in my code. But I also don't like calling a function every time to get a fixed value.

4 posts - 3 participants

Read full topic

🏷️ Rust_feed