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

Instant is monotonically nondecreasing #43756

Merged
merged 2 commits into from
Aug 15, 2017

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Aug 9, 2017

We don't want to guarantee that Instant::now() != Instant::now() is
always true since that depends on the speed of the processor and the
resolution of the clock.

We don't want to guarantee that `Instant::now() != Instant::now()` is
always true since that depends on the speed of the processor and the
resolution of the clock.
@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytm
Copy link
Member

kennytm commented Aug 9, 2017

Mathematically speaking, "monotonically increasing" already means x ≥ y ⇒ f(x) ≥ f(y), what you are thinking is "strictly increasing".

@scalexm
Copy link
Member

scalexm commented Aug 9, 2017

@kennytm actually "strictly increasing" is:
∀x∀y (x ≥ y ⇔ f(x) ≥ f(y))

"Monotonically increasing" (or "nondecreasing") however is:
∀x∀y (x ≥ y ⇒ f(x) ≥ f(y))
(no reciprocal, take for a counterexample a constant function, which is nondecreasing)

@kennytm
Copy link
Member

kennytm commented Aug 9, 2017

@scalexm Thanks, updated the arrow.

@sfackler
Copy link
Member Author

sfackler commented Aug 9, 2017

Ah right - I think only the second fix is needed then.

@sfackler
Copy link
Member Author

sfackler commented Aug 9, 2017

Er, actually, I think the first change is still correct - Wolfram defines "monotonic function" as "A monotonic function is a function which is either entirely nonincreasing or nondecreasing." (http://mathworld.wolfram.com/MonotonicFunction.html), so Instant is monotonic, but not monotonically increasing, which is defined as "Always increasing; never remaining constant or decreasing." (http://mathworld.wolfram.com/MonotoneIncreasing.html)

@scalexm
Copy link
Member

scalexm commented Aug 9, 2017

@sfackler From my understanding of english terminology, "monotonically increasing" or simply "increasing" usually means "strictly increasing", but sometimes it can just mean "nondecreasing", depending on authors and contexts. So I think you should indeed stick with "monotonically nondecreasing" which is unambiguous.

But anyway the second fix is the most important since "greater" indeed means "strictly greater" with standard terminology.

/// Opaque and useful only with `Duration`.
///
/// Instants are always guaranteed to be greater than any previously measured
/// Instants are always guaranteed to no less than any previously measured
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"be no less" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks

@aidanhs aidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 10, 2017
@carols10cents
Copy link
Member

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned brson Aug 14, 2017
@alexcrichton
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 14, 2017

📌 Commit 97d046a has been approved by alexcrichton

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 15, 2017
…lexcrichton

Instant is monotonically nondecreasing

We don't want to guarantee that `Instant::now() != Instant::now()` is
always true since that depends on the speed of the processor and the
resolution of the clock.
bors added a commit that referenced this pull request Aug 15, 2017
Rollup of 6 pull requests

- Successful merges: #43756, #43790, #43846, #43848, #43862, #43868
- Failed merges:
@bors bors merged commit 97d046a into rust-lang:master Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants