All common type aliases are defined in src/util/types.rs and re-exported through src/util/mod.rs.
- Definition:
pub type Float = f32; - Usage: The primary floating-point type used for all mathematical computations throughout the project
- Import:
use crate::util::Float;
- Definition:
pub type Int = i32; - Usage: Integer type for indexing and counts
- Import:
use crate::util::Int;
Simply import the type from crate::util:
use crate::util::Float;
fn my_function(x: Float) -> Float {
x * 2.0
}If you need to switch to double precision (f64), simply change the definition in src/util/types.rs:
pub type Float = f64;All code using Float will automatically use the new precision.