Skip to content

Commit d84d18e

Browse files
Rollup merge of #155133 - cuviper:duration_fp_docs, r=the8472
Document precision considerations of `Duration`-float methods A `Duration` is essentially a 94-bit value (64-bit sec and ~30-bit ns), so there's some inherent loss when converting to floating-point for `mul_f64` and `div_f64`. We could go to greater lengths to compute these with more accuracy, like rust-lang/rust#150933 or rust-lang/rust#154107, but it's not clear that it's worth the effort. The least we can do is document that some rounding is to be expected, which this commit does with simple examples that only multiply or divide by `1.0`. This also changes the `f32` methods to just forward to `f64`, so we keep more of that duration precision, as the range is otherwise much more limited there.
2 parents df63946 + fc036c1 commit d84d18e

0 file changed

File tree

    0 commit comments

    Comments
     (0)