Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::time::Duration::from_secs_f64 behavior changed in 1.63.0 #100480

Closed
youknowone opened this issue Aug 13, 2022 · 3 comments · Fixed by #100482
Closed

std::time::Duration::from_secs_f64 behavior changed in 1.63.0 #100480

youknowone opened this issue Aug 13, 2022 · 3 comments · Fixed by #100482
Labels
C-bug Category: This is a bug. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Milestone

Comments

@youknowone
Copy link
Contributor

youknowone commented Aug 13, 2022

Though the PR describes the change is related to improve its truncation better, the changed behavior is rounding up which was down before.

EDIT: The upper changes and issue related to 1.60. It is not related to this issue.

I want to check if this is expected change or regression.

Code

I tried this code:

use std::time::Duration;

fn main() {
    let f: f64 = 1.0020030005;
    let d = Duration::from_secs_f64(f);
    println!("{d:?}");
}

I expected to see this happen: explanation
Until 1.62.1,

1.002003s

Instead, this happened: explanation
In 1.63.0,

1.002003001s

Version it worked on

It most recently worked on: Until 1.62.1

Version with regression

rustc --version --verbose:

rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: aarch64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5
@youknowone youknowone added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Aug 13, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 13, 2022
@compiler-errors
Copy link
Member

@youknowone -- that PR you linked landed in 1.60, not 1.63?

@youknowone
Copy link
Contributor Author

Oh, I am sorry. I probably didn't check how much I scrolled down from release note.
Then which change would be related?

@compiler-errors
Copy link
Member

#96051

@Mark-Simulacrum Mark-Simulacrum added this to the 1.63.0 milestone Aug 13, 2022
@Mark-Simulacrum Mark-Simulacrum added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed regression-untriaged Untriaged performance or correctness regression. labels Aug 13, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 14, 2022
Add Duration rounding change to release note

one of possible fix of rust-lang#100480

fixes rust-lang#100480
@bors bors closed this as completed in 6e53472 Aug 15, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants