Skip to main content

promoted_type

Macro promoted_type 

Source
promoted_type!() { /* proc-macro */ }
Expand description

Compile-time type promotion macro.

Given two numeric types, resolves to the smallest type that can represent both without precision loss, following NumPy’s promotion rules.

§Examples

type R = promoted_type!(f32, f64); // R = f64
type R = promoted_type!(i32, f32); // R = f64
type R = promoted_type!(u8, i8);   // R = i16