You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking Issue for Duration::as_millis_{f64,f32} #122451
implDuration{/// Returns the number of milliseconds contained by this `Duration` as `f64`.////// The returned value does include the fractional (nanosecond) part of the duration.////// # Examples/// ```/// use std::time::Duration;////// let dur = Duration::new(2, 67_890_000);/// assert_eq!(dur.as_millis_f64(), 2678.9);/// ```pubconstfnas_millis_f64(self);/// Returns the number of milliseconds contained by this `Duration` as `f32`.////// The returned value does include the fractional (nanosecond) part of the duration.////// # Examples/// ```/// use std::time::Duration;////// let dur = Duration::new(2, 67_890_000);/// assert_eq!(dur.as_millis_f32(), 2678.9);/// ```pubconstfnas_millis_f32(self);}
The implementation is using floating-point division; would we be ok with changing it to multiplication-by-reciprocal at the cost of a ½ULP but being faster? as_secs_f32 uses division, so maybe not.
Activity
Rollup merge of rust-lang#122479 - GrigorenkoPV:duration_millis_float…
Unrolled build for rust-lang#122479
Rollup merge of rust-lang#131289 - RalfJung:duration_consts_float, r=…
Unrolled build for rust-lang#131289
Rollup merge of #131289 - RalfJung:duration_consts_float, r=tgross35
LunarLambda commentedon Sep 9, 2026
This has been open and implemented for two years, can this be nominated for FCP?